Skip to content

Commit e6e051d

Browse files
committed
Don't collect from phi nodes which are not fully constructed yet
1 parent 26d9cb1 commit e6e051d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

llvm/lib/Analysis/ScalarEvolution.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15823,7 +15823,9 @@ void ScalarEvolution::LoopGuards::collectFromBlock(
1582315823
Depth < MaxLoopGuardCollectionDepth) {
1582415824
SmallDenseMap<const BasicBlock *, LoopGuards> IncomingGuards;
1582515825
for (auto &Phi : Pair.second->phis())
15826-
collectFromPHI(SE, Guards, Phi, VisitedBlocks, IncomingGuards, Depth);
15826+
// We don't collect from PHIs that are under construction.
15827+
if (Pair.second->hasNPredecessors(Phi.getNumIncomingValues()))
15828+
collectFromPHI(SE, Guards, Phi, VisitedBlocks, IncomingGuards, Depth);
1582715829
}
1582815830

1582915831
// Now apply the information from the collected conditions to

0 commit comments

Comments
 (0)