aboutsummaryrefslogtreecommitdiffstats
path: root/test/libevmasm/Optimiser.cpp
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-10-17 04:11:45 +0800
committerGitHub <noreply@github.com>2017-10-17 04:11:45 +0800
commit7989fc4c356929de47e2d696ef5478c398941508 (patch)
tree35cfd7db3b44364243b295c3e6f19d05beb1a996 /test/libevmasm/Optimiser.cpp
parent18a72dbe4668e23aaf38404183b978fbbb1824d1 (diff)
parentf5e91e4a94b01daf2bbde637abef1796f063c348 (diff)
downloaddexon-solidity-7989fc4c356929de47e2d696ef5478c398941508.tar.gz
dexon-solidity-7989fc4c356929de47e2d696ef5478c398941508.tar.zst
dexon-solidity-7989fc4c356929de47e2d696ef5478c398941508.zip
Merge pull request #3077 from ethereum/optimze_pops
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{