Merge pull request #3077 from ethereum/optimze_pops

Assume peephole optimizer was successful if number of pops increased.
This commit is contained in:
chriseth
2017-10-16 22:11:45 +02:00
committed by GitHub
4 changed files with 27 additions and 2 deletions
+14
View File
@@ -841,6 +841,20 @@ BOOST_AUTO_TEST_CASE(peephole_double_push)
);
}
BOOST_AUTO_TEST_CASE(peephole_pop_calldatasize)
{
AssemblyItems items{
u256(4),
Instruction::CALLDATASIZE,
Instruction::LT,
Instruction::POP
};
PeepholeOptimiser peepOpt(items);
for (size_t i = 0; i < 3; i++)
BOOST_CHECK(peepOpt.optimise());
BOOST_CHECK(items.empty());
}
BOOST_AUTO_TEST_CASE(jumpdest_removal)
{
AssemblyItems items{