Optimize some instruction comparisons.

This commit is contained in:
chriseth 2018-12-18 16:09:51 +01:00
parent 01249984f2
commit 27e4e25a99
2 changed files with 3 additions and 5 deletions

View File

@ -160,8 +160,7 @@ struct CommutativeSwap: SimplePeepholeOptimizerMethod<CommutativeSwap, 2>
{ {
// Remove SWAP1 if following instruction is commutative // Remove SWAP1 if following instruction is commutative
if ( if (
_swap.type() == Operation && _swap == Instruction::SWAP1 &&
_swap.instruction() == Instruction::SWAP1 &&
SemanticInformation::isCommutativeOperation(_op) SemanticInformation::isCommutativeOperation(_op)
) )
{ {
@ -185,8 +184,7 @@ struct SwapComparison: SimplePeepholeOptimizerMethod<SwapComparison, 2>
}; };
if ( if (
_swap.type() == Operation && _swap == Instruction::SWAP1 &&
_swap.instruction() == Instruction::SWAP1 &&
_op.type() == Operation && _op.type() == Operation &&
swappableOps.count(_op.instruction()) swappableOps.count(_op.instruction())
) )

View File

@ -108,7 +108,7 @@ bool SemanticInformation::isSwapInstruction(AssemblyItem const& _item)
bool SemanticInformation::isJumpInstruction(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) bool SemanticInformation::altersControlFlow(AssemblyItem const& _item)