aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/ScalarEvolution.cpp
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2006-12-12 09:17:50 +0000
committerReid Spencer <rspencer@reidspencer.com>2006-12-12 09:17:50 +0000
commitb6ba3e6d85c99d959b243a1d0331b9b6d3fb7a44 (patch)
tree086092d8d2e260643f7c95c8211c040ffb5f377f /lib/Analysis/ScalarEvolution.cpp
parentdaa8e3c2633aa876b6cd572f5528cfe2bdb0ccc3 (diff)
Get even more accurate on the casting.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32478 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/ScalarEvolution.cpp')
-rw-r--r--lib/Analysis/ScalarEvolution.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp
index 703a1c46e9..46b8f2629c 100644
--- a/lib/Analysis/ScalarEvolution.cpp
+++ b/lib/Analysis/ScalarEvolution.cpp
@@ -1567,8 +1567,7 @@ SCEVHandle ScalarEvolutionsImpl::ComputeIterationCount(const Loop *L) {
ConstantInt *CompVal = RHSC->getValue();
const Type *RealTy = ExitCond->getOperand(0)->getType();
CompVal = dyn_cast<ConstantInt>(
- ConstantExpr::getIntegerCast(CompVal, RealTy,
- CompVal->getType()->isSigned()));
+ ConstantExpr::getBitCast(CompVal, RealTy));
if (CompVal) {
// Form the constant range.
ConstantRange CompRange(Cond, CompVal);
@@ -1577,12 +1576,10 @@ SCEVHandle ScalarEvolutionsImpl::ComputeIterationCount(const Loop *L) {
// range.
if (CompRange.getLower()->getType()->isSigned()) {
const Type *NewTy = RHSC->getValue()->getType();
- Constant *NewL =
- ConstantExpr::getIntegerCast(CompRange.getLower(), NewTy,
- CompRange.getLower()->getType()->isSigned());
- Constant *NewU =
- ConstantExpr::getIntegerCast(CompRange.getUpper(), NewTy,
- CompRange.getUpper()->getType()->isSigned());
+ Constant *NewL = ConstantExpr::getBitCast(CompRange.getLower(),
+ NewTy);
+ Constant *NewU = ConstantExpr::getBitCast(CompRange.getUpper(),
+ NewTy);
CompRange = ConstantRange(NewL, NewU);
}