aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2016-10-24 21:50:31 +0800
committerGitHub <noreply@github.com>2016-10-24 21:50:31 +0800
commit9e0594f4c1bf34a48771c7d67e6c76e1197425ae (patch)
treeff3e0bf1ba9ffae0335b0856fc16e8536899f0c7
parent2f1310124308cba97e5b14c3f4a089a435320582 (diff)
parent6686ea6c03d80f11ef55352b917ef13a06dfd244 (diff)
downloaddexon-solidity-9e0594f4c1bf34a48771c7d67e6c76e1197425ae.tar.gz
dexon-solidity-9e0594f4c1bf34a48771c7d67e6c76e1197425ae.tar.zst
dexon-solidity-9e0594f4c1bf34a48771c7d67e6c76e1197425ae.zip
Merge pull request #1270 from ethereum/optimise-eq0
Optimise 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; }},