From a20b23a7a835a31a5a35974000e5ddcc7cbfdbff Mon Sep 17 00:00:00 2001 From: chriseth Date: Sat, 6 Jun 2015 12:42:36 +0200 Subject: [PATCH] Optimize double ISZERO. --- libsolidity/SolidityOptimizer.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libsolidity/SolidityOptimizer.cpp b/libsolidity/SolidityOptimizer.cpp index 4ed081fdb..de704c0d4 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{