From 85cd132068b8010f63feb9354fbd7ab4e2c2aff8 Mon Sep 17 00:00:00 2001 From: Sanjoy Das Date: Mon, 20 Feb 2017 23:37:11 +0000 Subject: [IndVars] Add an assert We've already checked that the loop is in simplify form before, but a little paranoia never hurt anyone. llvm-svn: 295680 --- llvm/lib/Transforms/Scalar/IndVarSimplify.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'llvm/lib') diff --git a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp index 0aa5f2d9a46..1991acbf4bc 100644 --- a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp +++ b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp @@ -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; -- cgit v1.2.3