diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2016-11-09 19:28:53 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2016-11-30 19:16:43 +0800 |
commit | 8d0b80f944c42e871e42c320dfabf92c707ed9b7 (patch) | |
tree | 63112a3f030f447d90cca66d1a3ffd0a11efb464 /test | |
parent | 3fdef92911ea1824f7a84ce556fec48e23a314ad (diff) | |
download | dexon-solidity-8d0b80f944c42e871e42c320dfabf92c707ed9b7.tar dexon-solidity-8d0b80f944c42e871e42c320dfabf92c707ed9b7.tar.gz dexon-solidity-8d0b80f944c42e871e42c320dfabf92c707ed9b7.tar.bz2 dexon-solidity-8d0b80f944c42e871e42c320dfabf92c707ed9b7.tar.lz dexon-solidity-8d0b80f944c42e871e42c320dfabf92c707ed9b7.tar.xz dexon-solidity-8d0b80f944c42e871e42c320dfabf92c707ed9b7.tar.zst dexon-solidity-8d0b80f944c42e871e42c320dfabf92c707ed9b7.zip |
Add test for SUB with 0 optimisation
Diffstat (limited to 'test')
-rw-r--r-- | test/libsolidity/SolidityOptimizer.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityOptimizer.cpp b/test/libsolidity/SolidityOptimizer.cpp index a53a2638..90caaab0 100644 --- a/test/libsolidity/SolidityOptimizer.cpp +++ b/test/libsolidity/SolidityOptimizer.cpp @@ -1304,6 +1304,28 @@ BOOST_AUTO_TEST_CASE(invalid_state_at_control_flow_join) compareVersions("test()"); } +BOOST_AUTO_TEST_CASE(cse_sub_zero) +{ + checkCSE({ + u256(0), + u256(5), + Instruction::SUB + }, { + u256(5) + }); + + checkCSE({ + u256(5), + u256(0), + Instruction::SUB + }, { + u256(5), + u256(0), + Instruction::SUB + }); +} + + BOOST_AUTO_TEST_SUITE_END() } |