aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/Scalar/IndVarSimplify.cpp
diff options
context:
space:
mode:
authorAndrew Trick <atrick@apple.com>2013-07-12 22:08:41 +0000
committerAndrew Trick <atrick@apple.com>2013-07-12 22:08:41 +0000
commit7137909128e6447c556b2713a60cd8e62f823612 (patch)
tree6fd224e3d381214bfe025c920e5b5d5ecd1bd8a3 /lib/Transforms/Scalar/IndVarSimplify.cpp
parentadde9da01c78dd837a4e32217c9445c2c1aadb27 (diff)
downloadexternal_llvm-7137909128e6447c556b2713a60cd8e62f823612.zip
external_llvm-7137909128e6447c556b2713a60cd8e62f823612.tar.gz
external_llvm-7137909128e6447c556b2713a60cd8e62f823612.tar.bz2
Cleanup: rename a variable to make the logic easier to follow.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186213 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/IndVarSimplify.cpp')
-rw-r--r--lib/Transforms/Scalar/IndVarSimplify.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/Transforms/Scalar/IndVarSimplify.cpp b/lib/Transforms/Scalar/IndVarSimplify.cpp
index df11e92..b49bca7 100644
--- a/lib/Transforms/Scalar/IndVarSimplify.cpp
+++ b/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;
}