From 6777f7a57fed6b39128773f13084da729dd64588 Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 8 Mar 2018 19:41:29 +0100 Subject: Optimize across MLOAD if MSIZE is not used. --- libevmasm/Assembly.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'libevmasm/Assembly.cpp') diff --git a/libevmasm/Assembly.cpp b/libevmasm/Assembly.cpp index bd4ebf59..b71bc80c 100644 --- a/libevmasm/Assembly.cpp +++ b/libevmasm/Assembly.cpp @@ -438,13 +438,15 @@ map Assembly::optimiseInternal( // function types that can be stored in storage. AssemblyItems optimisedItems; + bool usesMSize = (find(m_items.begin(), m_items.end(), AssemblyItem(Instruction::MSIZE)) != m_items.end()); + auto iter = m_items.begin(); while (iter != m_items.end()) { KnownState emptyState; CommonSubexpressionEliminator eliminator(emptyState); auto orig = iter; - iter = eliminator.feedItems(iter, m_items.end()); + iter = eliminator.feedItems(iter, m_items.end(), usesMSize); bool shouldReplace = false; AssemblyItems optimisedChunk; try -- cgit