aboutsummaryrefslogtreecommitdiffstats
path: root/test/libevmasm/Optimiser.cpp
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-10-14 00:59:04 +0800
committerchriseth <chris@ethereum.org>2017-10-14 01:00:56 +0800
commit7c94e5462abb327016520b896178de41bea473c2 (patch)
treea3c44ae1b221c6bf1a288e43b4956d511cfe874a /test/libevmasm/Optimiser.cpp
parentd9bb4b44a4409db607ee74739f9a5ce1bd557067 (diff)
downloaddexon-solidity-7c94e5462abb327016520b896178de41bea473c2.tar.gz
dexon-solidity-7c94e5462abb327016520b896178de41bea473c2.tar.zst
dexon-solidity-7c94e5462abb327016520b896178de41bea473c2.zip
Assume peephole optimizer was successful if number of pops increased.
Diffstat (limited to 'test/libevmasm/Optimiser.cpp')
-rw-r--r--test/libevmasm/Optimiser.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/libevmasm/Optimiser.cpp b/test/libevmasm/Optimiser.cpp
index 9dc49581..0ab95b08 100644
--- a/test/libevmasm/Optimiser.cpp
+++ b/test/libevmasm/Optimiser.cpp
@@ -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{