summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilip Reames <listmail@philipreames.com>2019-07-16 18:23:49 +0000
committerPhilip Reames <listmail@philipreames.com>2019-07-16 18:23:49 +0000
commit6e1c3bb181b754f92501ee85f157345e25769317 (patch)
tree62142a569f505ba1136f13be89641631a7206af3
parent8f8d07e93bf891bf67329efb8f8d8609bf77f1c0 (diff)
downloadbcm5719-llvm-6e1c3bb181b754f92501ee85f157345e25769317.tar.gz
bcm5719-llvm-6e1c3bb181b754f92501ee85f157345e25769317.zip
[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
-rw-r--r--llvm/lib/Transforms/Scalar/IndVarSimplify.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
index 70508bf7525..f9fc698a4a9 100644
--- a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
+++ b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
@@ -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)
OpenPOWER on IntegriCloud