From ea84cd162cca7240eb770bcf93be1a994d0840fe Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Sat, 27 Jun 2009 22:58:27 +0000 Subject: Don't try to split a loop when the controlling icmp instruction doesn't have an IV-based operand. This fixes PR4471. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74399 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/LoopIndexSplit.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib/Transforms') diff --git a/lib/Transforms/Scalar/LoopIndexSplit.cpp b/lib/Transforms/Scalar/LoopIndexSplit.cpp index 6f7a7f8..ff0ec6d 100644 --- a/lib/Transforms/Scalar/LoopIndexSplit.cpp +++ b/lib/Transforms/Scalar/LoopIndexSplit.cpp @@ -258,6 +258,9 @@ bool LoopIndexSplit::runOnLoop(Loop *IncomingLoop, LPPassManager &LPM_Ref) { IVExitValue = ExitCondition->getOperand(0); if (!L->isLoopInvariant(IVExitValue)) return false; + if (!IVBasedValues.count( + ExitCondition->getOperand(IVExitValue == ExitCondition->getOperand(0)))) + return false; // If start value is more then exit value where induction variable // increments by 1 then we are potentially dealing with an infinite loop. -- cgit v1.1