diff options
author | Jakub Staszak <kubastaszak@gmail.com> | 2012-10-03 23:59:47 +0000 |
---|---|---|
committer | Jakub Staszak <kubastaszak@gmail.com> | 2012-10-03 23:59:47 +0000 |
commit | 395c1502a7e6380ec2210ee4be1fdb3128c10528 (patch) | |
tree | dde4ebceaedb8ea782f1cb506245441e3aef98b6 /lib/Transforms/Scalar | |
parent | 10181ae49c25e22267ea3d539dd53e07d5e45528 (diff) |
Fix PR13967.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165187 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar')
-rw-r--r-- | lib/Transforms/Scalar/IndVarSimplify.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/IndVarSimplify.cpp b/lib/Transforms/Scalar/IndVarSimplify.cpp index c933a178d79..23d0bb51b3e 100644 --- a/lib/Transforms/Scalar/IndVarSimplify.cpp +++ b/lib/Transforms/Scalar/IndVarSimplify.cpp @@ -1262,7 +1262,10 @@ static bool needsLFTR(Loop *L, DominatorTree *DT) { return true; // Do LFTR if the exit condition's IV is *not* a simple counter. - Value *IncV = Phi->getIncomingValueForBlock(L->getLoopLatch()); + int Idx = Phi->getBasicBlockIndex(L->getLoopLatch()); + if (Idx < 0) + return true; + Value *IncV = Phi->getIncomingValue(Idx); return Phi != getLoopPhiForCounter(IncV, L, DT); } |