1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

[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
This commit is contained in:
Philip Reames 2019-07-16 18:23:49 +00:00
parent 7bf76c2716
commit 505ac15599

View File

@ -2810,7 +2810,12 @@ bool IndVarSimplify::run(Loop *L) {
if (isa<SCEVCouldNotCompute>(ExitCount))
continue;
assert(!ExitCount->isZero() && "Should have been folded above");
// This was handled above, but as we form SCEVs, we can sometimes refine
// existing ones; this allows exit counts to be folded to zero which
// weren't when optimizeLoopExits saw them. Arguably, we should iterate
// until stable to handle cases like this better.
if (ExitCount->isZero())
continue;
PHINode *IndVar = FindLoopCounter(L, ExitingBB, ExitCount, SE, DT);
if (!IndVar)