aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2015-06-06 18:42:36 +0800
committerchriseth <c@ethdev.com>2015-06-06 18:42:36 +0800
commita20b23a7a835a31a5a35974000e5ddcc7cbfdbff (patch)
tree776411be4ba416b2869437c10fca6a086fbe5d82
parent187f5de2dd79b2868dc622aff4f44e65af2eabcc (diff)
downloaddexon-solidity-a20b23a7a835a31a5a35974000e5ddcc7cbfdbff.tar.gz
dexon-solidity-a20b23a7a835a31a5a35974000e5ddcc7cbfdbff.tar.zst
dexon-solidity-a20b23a7a835a31a5a35974000e5ddcc7cbfdbff.zip
Optimize double ISZERO.
-rw-r--r--libsolidity/SolidityOptimizer.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/libsolidity/SolidityOptimizer.cpp b/libsolidity/SolidityOptimizer.cpp
index 4ed081fd..de704c0d 100644
--- a/libsolidity/SolidityOptimizer.cpp
+++ b/libsolidity/SolidityOptimizer.cpp
@@ -440,6 +440,16 @@ BOOST_AUTO_TEST_CASE(cse_double_negation)
checkCSE({Instruction::DUP5, Instruction::NOT, Instruction::NOT}, {Instruction::DUP5});
}
+BOOST_AUTO_TEST_CASE(cse_double_iszero)
+{
+ checkCSE({Instruction::GT, Instruction::ISZERO, Instruction::ISZERO}, {Instruction::GT});
+ checkCSE({Instruction::GT, Instruction::ISZERO}, {Instruction::GT, Instruction::ISZERO});
+ checkCSE(
+ {Instruction::ISZERO, Instruction::ISZERO, Instruction::ISZERO},
+ {Instruction::ISZERO}
+ );
+}
+
BOOST_AUTO_TEST_CASE(cse_associativity)
{
AssemblyItems input{