aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2016-10-23 07:23:08 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2016-10-23 07:23:08 +0800
commit6686ea6c03d80f11ef55352b917ef13a06dfd244 (patch)
treeeac2724a03940708530177380b119b976fae80c5
parent3e13e59ff96d92f18b972f10f4ef1da1ef249b32 (diff)
downloaddexon-solidity-6686ea6c03d80f11ef55352b917ef13a06dfd244.tar.gz
dexon-solidity-6686ea6c03d80f11ef55352b917ef13a06dfd244.tar.zst
dexon-solidity-6686ea6c03d80f11ef55352b917ef13a06dfd244.zip
Optimiser the PUSH 0, EQ case as ISZERO
-rw-r--r--libevmasm/ExpressionClasses.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/libevmasm/ExpressionClasses.cpp b/libevmasm/ExpressionClasses.cpp
index 9d13a57a..cf5e6a0e 100644
--- a/libevmasm/ExpressionClasses.cpp
+++ b/libevmasm/ExpressionClasses.cpp
@@ -257,6 +257,7 @@ Rules::Rules()
{{Instruction::MOD, {0, X}}, [=]{ return u256(0); }},
{{Instruction::AND, {X, 0}}, [=]{ return u256(0); }},
{{Instruction::OR, {X, ~u256(0)}}, [=]{ return ~u256(0); }},
+ {{Instruction::EQ, {X, 0}}, [=]() -> Pattern { return {Instruction::ISZERO, {X}}; } },
// operations involving an expression and itself
{{Instruction::AND, {X, X}}, [=]{ return X; }},
{{Instruction::OR, {X, X}}, [=]{ return X; }},