summaryrefslogtreecommitdiff
path: root/lib/Transforms/Scalar/IndVarSimplify.cpp
diff options
context:
space:
mode:
authorJakub Staszak <kubastaszak@gmail.com>2012-10-04 19:08:30 +0000
committerJakub Staszak <kubastaszak@gmail.com>2012-10-04 19:08:30 +0000
commiteb51e95e61bd93cb764e14cdd5f0271e237e4673 (patch)
tree1e7aa40df328b028174499056a2d86b16914cc25 /lib/Transforms/Scalar/IndVarSimplify.cpp
parent916381569aa5cd33e4ed4c1585f48cf5da1a6684 (diff)
downloadllvm-eb51e95e61bd93cb764e14cdd5f0271e237e4673.tar.gz
llvm-eb51e95e61bd93cb764e14cdd5f0271e237e4673.tar.bz2
llvm-eb51e95e61bd93cb764e14cdd5f0271e237e4673.tar.xz
Add a comment to the commit r165187.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165238 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/IndVarSimplify.cpp')
-rw-r--r--lib/Transforms/Scalar/IndVarSimplify.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/IndVarSimplify.cpp b/lib/Transforms/Scalar/IndVarSimplify.cpp
index 23d0bb51b3..af0ee34d0d 100644
--- a/lib/Transforms/Scalar/IndVarSimplify.cpp
+++ b/lib/Transforms/Scalar/IndVarSimplify.cpp
@@ -1261,10 +1261,12 @@ static bool needsLFTR(Loop *L, DominatorTree *DT) {
if (!Phi)
return true;
- // Do LFTR if the exit condition's IV is *not* a simple counter.
+ // Do LFTR if PHI node is defined in the loop, but is *not* a counter.
int Idx = Phi->getBasicBlockIndex(L->getLoopLatch());
if (Idx < 0)
return true;
+
+ // Do LFTR if the exit condition's IV is *not* a simple counter.
Value *IncV = Phi->getIncomingValue(Idx);
return Phi != getLoopPhiForCounter(IncV, L, DT);
}