mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Optimize some instruction comparisons.
This commit is contained in:
parent
01249984f2
commit
27e4e25a99
@ -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())
|
||||||
)
|
)
|
||||||
|
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user