diff --git a/libevmasm/PeepholeOptimiser.cpp b/libevmasm/PeepholeOptimiser.cpp index f3ae8cbf1..e211026b2 100644 --- a/libevmasm/PeepholeOptimiser.cpp +++ b/libevmasm/PeepholeOptimiser.cpp @@ -160,8 +160,7 @@ struct CommutativeSwap: SimplePeepholeOptimizerMethod { // 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 }; 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 78f3c9c7b..2a24a27ea 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)