Skip to content

Commit 6e1c3bb

Browse files
committedJul 16, 2019
[IndVars] Speculative fix for an assertion failure seen in bots
I don't have an IR sample which is actually failing, but the issue described in the comment is theoretically possible, and should be guarded against even if there's a different root cause for the bot failures. llvm-svn: 366241
1 parent 8f8d07e commit 6e1c3bb

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed
 

‎llvm/lib/Transforms/Scalar/IndVarSimplify.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -2810,7 +2810,12 @@ bool IndVarSimplify::run(Loop *L) {
28102810
if (isa<SCEVCouldNotCompute>(ExitCount))
28112811
continue;
28122812

2813-
assert(!ExitCount->isZero() && "Should have been folded above");
2813+
// This was handled above, but as we form SCEVs, we can sometimes refine
2814+
// existing ones; this allows exit counts to be folded to zero which
2815+
// weren't when optimizeLoopExits saw them. Arguably, we should iterate
2816+
// until stable to handle cases like this better.
2817+
if (ExitCount->isZero())
2818+
continue;
28142819

28152820
PHINode *IndVar = FindLoopCounter(L, ExitingBB, ExitCount, SE, DT);
28162821
if (!IndVar)

0 commit comments

Comments
 (0)
Please sign in to comment.