fixup! Limit max chunk size in CommonSubexpressionEliminator::feedItems

This commit is contained in:
wechman 2022-03-25 13:13:49 +01:00
parent 63f53a19dd
commit 91638ed7b2

View File

@ -180,13 +180,14 @@ AssemblyItemIterator CommonSubexpressionEliminator::feedItems(
{ {
assertThrow(!m_breakingItem, OptimizerException, "Invalid use of CommonSubexpressionEliminator."); assertThrow(!m_breakingItem, OptimizerException, "Invalid use of CommonSubexpressionEliminator.");
unsigned const maxChunkSize = 1000; unsigned const maxChunkSize = 1000;
unsigned chunkSize = 0;
for ( for (
unsigned chunkSize = 0; ;
_iterator != _end && !SemanticInformation::breaksCSEAnalysisBlock(*_iterator, _msizeImportant) && chunkSize < maxChunkSize; _iterator != _end && !SemanticInformation::breaksCSEAnalysisBlock(*_iterator, _msizeImportant) && chunkSize < maxChunkSize;
++_iterator, ++chunkSize ++_iterator, ++chunkSize
) )
feedItem(*_iterator); feedItem(*_iterator);
if (_iterator != _end) if (_iterator != _end && chunkSize < maxChunkSize)
m_breakingItem = &(*_iterator++); m_breakingItem = &(*_iterator++);
return _iterator; return _iterator;
} }