[llvm] r295680 - [IndVars] Add an assert

Sanjoy Das via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 20 15:37:11 PST 2017


Author: sanjoy
Date: Mon Feb 20 17:37:11 2017
New Revision: 295680

URL: http://llvm.org/viewvc/llvm-project?rev=295680&view=rev
Log:
[IndVars] Add an assert

We've already checked that the loop is in simplify form before, but a
little paranoia never hurt anyone.

Modified:
    llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp?rev=295680&r1=295679&r2=295680&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp Mon Feb 20 17:37:11 2017
@@ -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;
 




More information about the llvm-commits mailing list