aboutsummaryrefslogtreecommitdiffstats
path: root/libevmasm/PeepholeOptimiser.cpp
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-12-18 23:09:51 +0800
committerchriseth <chris@ethereum.org>2018-12-19 00:25:49 +0800
commit27e4e25a99d32be439ad1db9516b1f9f7d80cd99 (patch)
tree4b630e9945fa07d24de80dec619397f3c1f253be /libevmasm/PeepholeOptimiser.cpp
parent01249984f2b5cbabc9fe3d4fd98917c606f77931 (diff)
downloaddexon-solidity-27e4e25a99d32be439ad1db9516b1f9f7d80cd99.tar.gz
dexon-solidity-27e4e25a99d32be439ad1db9516b1f9f7d80cd99.tar.zst
dexon-solidity-27e4e25a99d32be439ad1db9516b1f9f7d80cd99.zip
Optimize some instruction comparisons.
Diffstat (limited to 'libevmasm/PeepholeOptimiser.cpp')
-rw-r--r--libevmasm/PeepholeOptimiser.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/libevmasm/PeepholeOptimiser.cpp b/libevmasm/PeepholeOptimiser.cpp
index f3ae8cbf..e211026b 100644
--- a/libevmasm/PeepholeOptimiser.cpp
+++ b/libevmasm/PeepholeOptimiser.cpp
@@ -160,8 +160,7 @@ struct CommutativeSwap: SimplePeepholeOptimizerMethod<CommutativeSwap, 2>
{
// Remove SWAP1 if following instruction is commutative
if (
- _swap.type() == Operation &&
- _swap.instruction() == Instruction::SWAP1 &&
+ _swap == Instruction::SWAP1 &&
SemanticInformation::isCommutativeOperation(_op)
)
{
@@ -185,8 +184,7 @@ struct SwapComparison: SimplePeepholeOptimizerMethod<SwapComparison, 2>
};
if (
- _swap.type() == Operation &&
- _swap.instruction() == Instruction::SWAP1 &&
+ _swap == Instruction::SWAP1 &&
_op.type() == Operation &&
swappableOps.count(_op.instruction())
)