]> granicus.if.org Git - llvm/commitdiff
[IndVars] Add an assert
authorSanjoy Das <sanjoy@playingwithpointers.com>
Mon, 20 Feb 2017 23:37:11 +0000 (23:37 +0000)
committerSanjoy Das <sanjoy@playingwithpointers.com>
Mon, 20 Feb 2017 23:37:11 +0000 (23:37 +0000)
We've already checked that the loop is in simplify form before, but a
little paranoia never hurt anyone.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295680 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/IndVarSimplify.cpp

index 0aa5f2d9a46563441d981ffffdb18e51b1d3bb80..1991acbf4bca8ee4d21cfcf0af33b5acb09046e5 100644 (file)
@@ -2152,6 +2152,8 @@ linearFunctionTestReplace(Loop *L,
   Value *CmpIndVar = IndVar;
   const SCEV *IVCount = BackedgeTakenCount;
 
+  assert(L->getLoopLatch() && "Loop no longer in simplified form?");
+
   // If the exiting block is the same as the backedge block, we prefer to
   // compare against the post-incremented value, otherwise we must compare
   // against the preincremented value.
@@ -2376,6 +2378,7 @@ bool IndVarSimplify::run(Loop *L) {
   //    Loop::getCanonicalInductionVariable only supports loops with preheaders,
   //    and we're in trouble if we can't find the induction variable even when
   //    we've manually inserted one.
+  //  - LFTR relies on having a single backedge.
   if (!L->isLoopSimplifyForm())
     return false;