diff options
author | chriseth <c@ethdev.com> | 2015-06-12 17:06:05 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2015-06-12 17:31:03 +0800 |
commit | 91a72076164793ced6887d8c65eb73a265689999 (patch) | |
tree | 7982f28a76d6ae1de87b6110f47b66b6c80ff6cd | |
parent | 41db3a6162cdb0d9450de6df604d93b65847c212 (diff) | |
download | dexon-solidity-91a72076164793ced6887d8c65eb73a265689999.tar.gz dexon-solidity-91a72076164793ced6887d8c65eb73a265689999.tar.zst dexon-solidity-91a72076164793ced6887d8c65eb73a265689999.zip |
Optimize RETURN x 0 to STOP.
-rw-r--r-- | libsolidity/SolidityOptimizer.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libsolidity/SolidityOptimizer.cpp b/libsolidity/SolidityOptimizer.cpp index 397ee631..85a88c03 100644 --- a/libsolidity/SolidityOptimizer.cpp +++ b/libsolidity/SolidityOptimizer.cpp @@ -944,6 +944,14 @@ BOOST_AUTO_TEST_CASE(cse_access_previous_sequence) // 0, SLOAD, 1, ADD, SSTORE, 0 SLOAD } +BOOST_AUTO_TEST_CASE(cse_optimise_return) +{ + checkCSE( + AssemblyItems{u256(0), u256(7), Instruction::RETURN}, + AssemblyItems{Instruction::STOP} + ); +} + BOOST_AUTO_TEST_CASE(control_flow_graph_remove_unused) { // remove parts of the code that are unused |