aboutsummaryrefslogtreecommitdiffstats
path: root/libevmasm
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
parent01249984f2b5cbabc9fe3d4fd98917c606f77931 (diff)
downloaddexon-solidity-27e4e25a99d32be439ad1db9516b1f9f7d80cd99.tar.gz
dexon-solidity-27e4e25a99d32be439ad1db9516b1f9f7d80cd99.tar.zst
dexon-solidity-27e4e25a99d32be439ad1db9516b1f9f7d80cd99.zip
Optimize some instruction comparisons.
Diffstat (limited to 'libevmasm')
-rw-r--r--libevmasm/PeepholeOptimiser.cpp6
-rw-r--r--libevmasm/SemanticInformation.cpp2
2 files changed, 3 insertions, 5 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())
)
diff --git a/libevmasm/SemanticInformation.cpp b/libevmasm/SemanticInformation.cpp
index 78f3c9c7..2a24a27e 100644
--- a/libevmasm/SemanticInformation.cpp
+++ b/libevmasm/SemanticInformation.cpp
@@ -108,7 +108,7 @@ bool SemanticInformation::isSwapInstruction(AssemblyItem const& _item)
bool SemanticInformation::isJumpInstruction(AssemblyItem const& _item)
{
- return _item == AssemblyItem(Instruction::JUMP) || _item == AssemblyItem(Instruction::JUMPI);
+ return _item == Instruction::JUMP || _item == Instruction::JUMPI;
}
bool SemanticInformation::altersControlFlow(AssemblyItem const& _item)