aboutsummaryrefslogtreecommitdiffstats
path: root/libevmasm/SemanticInformation.cpp
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-03-09 02:41:29 +0800
committerchriseth <chris@ethereum.org>2018-04-03 20:34:32 +0800
commit6777f7a57fed6b39128773f13084da729dd64588 (patch)
tree87b74e6f8e3f12eec98ca6b2265b23cf1e9f3a71 /libevmasm/SemanticInformation.cpp
parentd21382157cbda53d98f3a4e0d7c0d0a7d213aebf (diff)
downloaddexon-solidity-6777f7a57fed6b39128773f13084da729dd64588.tar
dexon-solidity-6777f7a57fed6b39128773f13084da729dd64588.tar.gz
dexon-solidity-6777f7a57fed6b39128773f13084da729dd64588.tar.bz2
dexon-solidity-6777f7a57fed6b39128773f13084da729dd64588.tar.lz
dexon-solidity-6777f7a57fed6b39128773f13084da729dd64588.tar.xz
dexon-solidity-6777f7a57fed6b39128773f13084da729dd64588.tar.zst
dexon-solidity-6777f7a57fed6b39128773f13084da729dd64588.zip
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)