From 1272951bbb6ab5728beba81cbe5efd31bba351ad Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Mon, 4 Mar 2019 14:00:54 +0100 Subject: [PATCH] Do not mask with 160-bits after CREATE/CREATE2 --- Changelog.md | 1 + libevmasm/RuleList.h | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Changelog.md b/Changelog.md index ea766f70b..936ec8f52 100644 --- a/Changelog.md +++ b/Changelog.md @@ -13,6 +13,7 @@ Compiler Features: * Optimizer: Add new rules with constants including ``LT``, ``GT``, ``AND`` and ``BYTE``. * Optimizer: Add rule for shifts with constants for Constantinople. * Optimizer: Combine multiple shifts with constant shift-by values into one. + * Optimizer: Do not mask with 160-bits after ``CREATE`` and ``CREATE2`` as they are guaranteed to return an address or 0. * Optimizer: Support shifts in the constant optimiser for Constantinople. * Yul Optimizer: Add rule to replace switch statements with const expr. with matching case body diff --git a/libevmasm/RuleList.h b/libevmasm/RuleList.h index 7ec3ca461..4215e50bd 100644 --- a/libevmasm/RuleList.h +++ b/libevmasm/RuleList.h @@ -237,7 +237,9 @@ std::vector> simplificationRuleListPart5( Instruction::ADDRESS, Instruction::CALLER, Instruction::ORIGIN, - Instruction::COINBASE + Instruction::COINBASE, + Instruction::CREATE, + Instruction::CREATE2 }) { u256 const mask = (u256(1) << 160) - 1;