Skip to content

Commit 59da748

Browse files
committed
Stop collecting guards after 2 predecessors in the recursive case
1 parent e4d5a76 commit 59da748

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

llvm/lib/Analysis/ScalarEvolution.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15665,6 +15665,10 @@ void ScalarEvolution::LoopGuards::collectFromBlock(
1566515665

1566615666
Terms.emplace_back(LoopEntryPredicate->getCondition(),
1566715667
LoopEntryPredicate->getSuccessor(0) == Pair.second);
15668+
15669+
// If we are recursively collecting guards stop after 2 predecessors.
15670+
if (Depth > 0 && Terms.size() == 2)
15671+
break;
1566815672
}
1566915673
// Finally, if we stopped climbing the predecessor chain because
1567015674
// there wasn't a unique one to continue, try to collect conditions

0 commit comments

Comments
 (0)