aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2015-03-27 07:24:31 +0800
committerchriseth <c@ethdev.com>2015-03-30 18:03:28 +0800
commit35274fb9b1a89589b60de7f54913d5f77712c6af (patch)
tree1d3238bc7662b2307a56d4bc95c5e649a549b1e3
parentb3fc122845c9f986d13b2a6b52df686ab5f1818e (diff)
downloaddexon-solidity-35274fb9b1a89589b60de7f54913d5f77712c6af.tar.gz
dexon-solidity-35274fb9b1a89589b60de7f54913d5f77712c6af.tar.zst
dexon-solidity-35274fb9b1a89589b60de7f54913d5f77712c6af.zip
Optimize breaking item.
-rw-r--r--SolidityOptimizer.cpp32
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()
}