diff options
author | Andrew Trick <atrick@apple.com> | 2013-07-12 22:08:41 +0000 |
---|---|---|
committer | Andrew Trick <atrick@apple.com> | 2013-07-12 22:08:41 +0000 |
commit | 466555e50d262471e23bfbc71fbbd20bbbd77145 (patch) | |
tree | 79c6556e0ee6302e54fd6fbf8c2a1bf13969fbcc /llvm/lib/Transforms | |
parent | 3931cf94acb998efdb3103f1420bf3ef2bc56afb (diff) | |
download | bcm5719-llvm-466555e50d262471e23bfbc71fbbd20bbbd77145.tar.gz bcm5719-llvm-466555e50d262471e23bfbc71fbbd20bbbd77145.zip |
Cleanup: rename a variable to make the logic easier to follow.
llvm-svn: 186213
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/Scalar/IndVarSimplify.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp index df11e92c9ed..b49bca7d12e 100644 --- a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp +++ b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp @@ -1556,29 +1556,29 @@ LinearFunctionTestReplace(Loop *L, // BECount. This avoids materializing the add(zext(add)) expression. Type *CntTy = BackedgeTakenCount->getType(); - const SCEV *IVCount = BackedgeTakenCount; - // If the exiting block is the same as the backedge block, we prefer to // compare against the post-incremented value, otherwise we must compare // against the preincremented value. Value *CmpIndVar; + const SCEV *IVCount; if (L->getExitingBlock() == L->getLoopLatch()) { // Add one to the "backedge-taken" count to get the trip count. // If this addition may overflow, we have to be more pessimistic and // cast the induction variable before doing the add. const SCEV *N = - SE->getAddExpr(IVCount, SE->getConstant(IVCount->getType(), 1)); - if (CntTy == IVCount->getType()) + SE->getAddExpr(BackedgeTakenCount, + SE->getConstant(BackedgeTakenCount->getType(), 1)); + if (CntTy == BackedgeTakenCount->getType()) IVCount = N; else { - const SCEV *Zero = SE->getConstant(IVCount->getType(), 0); + const SCEV *Zero = SE->getConstant(BackedgeTakenCount->getType(), 0); if ((isa<SCEVConstant>(N) && !N->isZero()) || SE->isLoopEntryGuardedByCond(L, ICmpInst::ICMP_NE, N, Zero)) { // No overflow. Cast the sum. IVCount = SE->getTruncateOrZeroExtend(N, CntTy); } else { // Potential overflow. Cast before doing the add. - IVCount = SE->getTruncateOrZeroExtend(IVCount, CntTy); + IVCount = SE->getTruncateOrZeroExtend(BackedgeTakenCount, CntTy); IVCount = SE->getAddExpr(IVCount, SE->getConstant(CntTy, 1)); } } @@ -1588,7 +1588,7 @@ LinearFunctionTestReplace(Loop *L, CmpIndVar = IndVar->getIncomingValueForBlock(L->getExitingBlock()); } else { // We must use the preincremented value... - IVCount = SE->getTruncateOrZeroExtend(IVCount, CntTy); + IVCount = SE->getTruncateOrZeroExtend(BackedgeTakenCount, CntTy); CmpIndVar = IndVar; } |