Skip to content

Commit 24ccbc6

Browse files
harshaduntwalesys_zuul
authored andcommitted
Fix to handle a infinite loop stuck issue leading to compilation hang.
Change-Id: I67b44072edb55ef6d8fe4e4b89d689d8e2cc63bd
1 parent 81c9379 commit 24ccbc6

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

IGC/Compiler/CustomUnsafeOptPass.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3056,11 +3056,18 @@ bool EarlyOutPatterns::processBlock(BasicBlock* BB)
30563056
DirectOutputPatternEnable = (IGC_GET_FLAG_VALUE(EarlyOutPatternSelectPS) & 0x10) != 0;
30573057
}
30583058

3059+
Instruction* nextII = nullptr;
30593060
while (BBSplit)
30603061
{
30613062
BBSplit = false;
3062-
for (auto& II : *BB)
3063+
for (auto iter = BB->begin();iter != BB->end() ;iter++)
30633064
{
3065+
if (nextII && iter != nextII->getIterator())
3066+
{
3067+
iter = nextII->getIterator();
3068+
}
3069+
Instruction& II = *iter;
3070+
nextII = II.getNextNode();
30643071
SmallVector<Instruction*, 4> Values;
30653072
bool OptCandidate = false;
30663073
Instruction* Root = &II;
@@ -3135,9 +3142,9 @@ bool EarlyOutPatterns::processBlock(BasicBlock* BB)
31353142

31363143
if (OptCandidate)
31373144
{
3138-
BB = tryFoldAndSplit(Values, Root,
3145+
BasicBlock* BB1 = tryFoldAndSplit(Values, Root,
31393146
FoldThreshold, FoldThresholdMultiChannel, RatioNeeded);
3140-
BBSplit = (BB != nullptr);
3147+
BBSplit = (BB1 != nullptr);
31413148

31423149
if (BBSplit)
31433150
break;

0 commit comments

Comments
 (0)