diff options
author | chriseth <c@ethdev.com> | 2015-03-27 07:24:31 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2015-03-30 18:03:28 +0800 |
commit | 35274fb9b1a89589b60de7f54913d5f77712c6af (patch) | |
tree | 1d3238bc7662b2307a56d4bc95c5e649a549b1e3 | |
parent | b3fc122845c9f986d13b2a6b52df686ab5f1818e (diff) | |
download | dexon-solidity-35274fb9b1a89589b60de7f54913d5f77712c6af.tar.gz dexon-solidity-35274fb9b1a89589b60de7f54913d5f77712c6af.tar.zst dexon-solidity-35274fb9b1a89589b60de7f54913d5f77712c6af.zip |
Optimize breaking item.
-rw-r--r-- | SolidityOptimizer.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/SolidityOptimizer.cpp b/SolidityOptimizer.cpp index cf35536e..e69d5120 100644 --- a/SolidityOptimizer.cpp +++ b/SolidityOptimizer.cpp @@ -536,6 +536,38 @@ BOOST_AUTO_TEST_CASE(cse_deep_stack) }); } +BOOST_AUTO_TEST_CASE(cse_jumpi_no_jump) +{ + AssemblyItems input{ + u256(0), + u256(1), + Instruction::DUP2, + AssemblyItem(PushTag, 1), + Instruction::JUMPI + }; + checkCSE(input, { + u256(0), + u256(1) + }); +} + +BOOST_AUTO_TEST_CASE(cse_jumpi_jump) +{ + AssemblyItems input{ + u256(1), + u256(1), + Instruction::DUP2, + AssemblyItem(PushTag, 1), + Instruction::JUMPI + }; + checkCSE(input, { + u256(1), + Instruction::DUP1, + AssemblyItem(PushTag, 1), + Instruction::JUMP + }); +} + BOOST_AUTO_TEST_SUITE_END() } |