summaryrefslogtreecommitdiff
path: root/lib/Transforms/Scalar/LoopIndexSplit.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-06-27 22:58:27 +0000
committerDan Gohman <gohman@apple.com>2009-06-27 22:58:27 +0000
commitf7ca1611e22d7b877ecfd444841f8c79deb5f9e4 (patch)
tree95635e2e6a5d9766c306e7fa93667394dbe5b619 /lib/Transforms/Scalar/LoopIndexSplit.cpp
parenta1baee20c4b042eca1f182fc003f38ab52efc7a9 (diff)
downloadllvm-f7ca1611e22d7b877ecfd444841f8c79deb5f9e4.tar.gz
llvm-f7ca1611e22d7b877ecfd444841f8c79deb5f9e4.tar.bz2
llvm-f7ca1611e22d7b877ecfd444841f8c79deb5f9e4.tar.xz
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
Diffstat (limited to 'lib/Transforms/Scalar/LoopIndexSplit.cpp')
-rw-r--r--lib/Transforms/Scalar/LoopIndexSplit.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/LoopIndexSplit.cpp b/lib/Transforms/Scalar/LoopIndexSplit.cpp
index 6f7a7f866a..ff0ec6d2ac 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.