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 | f8a8129513b9e2f2fd23c9a27e2b0e7a985fe1c4 (patch) | |
tree | 337035be433d79fc266b9ea73bd1f4ed9e485101 /llvm/lib | |
parent | f175ad152c187e76260fb562bc99febcabd77a45 (diff) | |
download | bcm5719-llvm-f8a8129513b9e2f2fd23c9a27e2b0e7a985fe1c4.tar.gz bcm5719-llvm-f8a8129513b9e2f2fd23c9a27e2b0e7a985fe1c4.zip |
Fix PR13967.
llvm-svn: 165187
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Transforms/Scalar/IndVarSimplify.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp index c933a178d79..23d0bb51b3e 100644 --- a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp +++ b/llvm/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); } |