From 91638ed7b221b8374646893bf10423168bd0f89d Mon Sep 17 00:00:00 2001 From: wechman Date: Fri, 25 Mar 2022 13:13:49 +0100 Subject: [PATCH] fixup! Limit max chunk size in CommonSubexpressionEliminator::feedItems --- libevmasm/CommonSubexpressionEliminator.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libevmasm/CommonSubexpressionEliminator.h b/libevmasm/CommonSubexpressionEliminator.h index 0b7d0e9f5..68d40d5ac 100644 --- a/libevmasm/CommonSubexpressionEliminator.h +++ b/libevmasm/CommonSubexpressionEliminator.h @@ -180,13 +180,14 @@ AssemblyItemIterator CommonSubexpressionEliminator::feedItems( { assertThrow(!m_breakingItem, OptimizerException, "Invalid use of CommonSubexpressionEliminator."); unsigned const maxChunkSize = 1000; + unsigned chunkSize = 0; for ( - unsigned chunkSize = 0; + ; _iterator != _end && !SemanticInformation::breaksCSEAnalysisBlock(*_iterator, _msizeImportant) && chunkSize < maxChunkSize; ++_iterator, ++chunkSize ) feedItem(*_iterator); - if (_iterator != _end) + if (_iterator != _end && chunkSize < maxChunkSize) m_breakingItem = &(*_iterator++); return _iterator; }