aboutsummaryrefslogtreecommitdiffstats
path: root/libevmasm/SemanticInformation.cpp
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2018-04-03 22:58:11 +0800
committerGitHub <noreply@github.com>2018-04-03 22:58:11 +0800
commit0edce4b570c157927933697b30f0f94cbdf173b2 (patch)
treea7ec50f920090e529b435e878e4df8cedd1f0eb4 /libevmasm/SemanticInformation.cpp
parent7753249f646f239819c62ab6847438dc84b6e04b (diff)
parentdeadff263fbf4d5da911d7c544821cc77081a6d3 (diff)
downloaddexon-solidity-0edce4b570c157927933697b30f0f94cbdf173b2.tar
dexon-solidity-0edce4b570c157927933697b30f0f94cbdf173b2.tar.gz
dexon-solidity-0edce4b570c157927933697b30f0f94cbdf173b2.tar.bz2
dexon-solidity-0edce4b570c157927933697b30f0f94cbdf173b2.tar.lz
dexon-solidity-0edce4b570c157927933697b30f0f94cbdf173b2.tar.xz
dexon-solidity-0edce4b570c157927933697b30f0f94cbdf173b2.tar.zst
dexon-solidity-0edce4b570c157927933697b30f0f94cbdf173b2.zip
Merge pull request #3693 from ethereum/optimizeMLOAD
Optimize across MLOAD if MSIZE is not used.
Diffstat (limited to 'libevmasm/SemanticInformation.cpp')
-rw-r--r--libevmasm/SemanticInformation.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/libevmasm/SemanticInformation.cpp b/libevmasm/SemanticInformation.cpp
index 03870f7c..71267ee8 100644
--- a/libevmasm/SemanticInformation.cpp
+++ b/libevmasm/SemanticInformation.cpp
@@ -28,7 +28,7 @@ using namespace std;
using namespace dev;
using namespace dev::eth;
-bool SemanticInformation::breaksCSEAnalysisBlock(AssemblyItem const& _item)
+bool SemanticInformation::breaksCSEAnalysisBlock(AssemblyItem const& _item, bool _msizeImportant)
{
switch (_item.type())
{
@@ -59,6 +59,11 @@ bool SemanticInformation::breaksCSEAnalysisBlock(AssemblyItem const& _item)
return false;
if (_item.instruction() == Instruction::MSTORE)
return false;
+ if (!_msizeImportant && (
+ _item.instruction() == Instruction::MLOAD ||
+ _item.instruction() == Instruction::KECCAK256
+ ))
+ return false;
//@todo: We do not handle the following memory instructions for now:
// calldatacopy, codecopy, extcodecopy, mstore8,
// msize (note that msize also depends on memory read access)