aboutsummaryrefslogtreecommitdiffstats
path: root/libevmasm/PeepholeOptimiser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libevmasm/PeepholeOptimiser.cpp')
-rw-r--r--libevmasm/PeepholeOptimiser.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/libevmasm/PeepholeOptimiser.cpp b/libevmasm/PeepholeOptimiser.cpp
index 104d9769..901e310e 100644
--- a/libevmasm/PeepholeOptimiser.cpp
+++ b/libevmasm/PeepholeOptimiser.cpp
@@ -68,14 +68,15 @@ struct AddPop
{
Instruction i0 = _in[0].instruction();
if (instructionInfo(i0).ret == 1 &&
- instructionInfo(i0).args == 2 &&
!SemanticInformation::invalidatesMemory(i0) &&
- !SemanticInformation::invalidatesStorage(i0)
+ !SemanticInformation::invalidatesStorage(i0) &&
+ !SemanticInformation::altersControlFlow(i0) &&
+ !instructionInfo(i0).sideEffects
)
{
- *_out = Instruction::POP;
- *_out = Instruction::POP;
- return true;
+ for (int j = 0; j < instructionInfo(i0).args; j++)
+ *_out = Instruction::POP;
+ return true;
}
}
return false;