Test case and comment for PR9633.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130294 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp
index 9396b07..1bef857 100644
--- a/lib/Analysis/ScalarEvolution.cpp
+++ b/lib/Analysis/ScalarEvolution.cpp
@@ -4705,8 +4705,9 @@
getAddRecExpr(NewOps, AddRec->getLoop(),
AddRec->getNoWrapFlags(SCEV::FlagNW));
AddRec = dyn_cast<SCEVAddRecExpr>(FoldedRec);
- // In cases with "undef" values, a loop's own recurrence may
- // fold into a constant. Go ahead and return the optimistic value.
+ // The addrec may be folded to a nonrecurrence, for example, if the
+ // induction variable is multiplied by zero after constant folding. Go
+ // ahead and return the folded value.
if (!AddRec)
return FoldedRec;
break;