aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/ScalarEvolution.cpp
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2007-02-28 18:57:32 +0000
committerReid Spencer <rspencer@reidspencer.com>2007-02-28 18:57:32 +0000
commitdc5c1597014fa5c47c94db2b9fd424d2266053db (patch)
tree9167714e90ee780fc0aabd5ccbfe73eadcf41ef0 /lib/Analysis/ScalarEvolution.cpp
parentf1b214d3ca12f2d85f0d092b4920172bcc797bac (diff)
For PR1205:
First round of ConstantRange changes. This makes all CR constructors use only APInt and not use ConstantInt. Clients are adjusted accordingly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34756 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/ScalarEvolution.cpp')
-rw-r--r--lib/Analysis/ScalarEvolution.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp
index a81f24f117..0507b39b7d 100644
--- a/lib/Analysis/ScalarEvolution.cpp
+++ b/lib/Analysis/ScalarEvolution.cpp
@@ -177,7 +177,7 @@ SCEVHandle SCEVConstant::get(ConstantInt *V) {
}
ConstantRange SCEVConstant::getValueRange() const {
- return ConstantRange(V);
+ return ConstantRange(V->getValue());
}
const Type *SCEVConstant::getType() const { return V->getType(); }
@@ -490,12 +490,11 @@ static SCEVHandle PartialFact(SCEVHandle V, unsigned NumSteps) {
// Handle this case efficiently, it is common to have constant iteration
// counts while computing loop exit values.
if (SCEVConstant *SC = dyn_cast<SCEVConstant>(V)) {
- uint64_t Val = SC->getValue()->getZExtValue();
- uint64_t Result = 1;
+ APInt Val = SC->getValue()->getValue();
+ APInt Result(Val.getBitWidth(), 1);
for (; NumSteps; --NumSteps)
Result *= Val-(NumSteps-1);
- Constant *Res = ConstantInt::get(Type::Int64Ty, Result);
- return SCEVUnknown::get(ConstantExpr::getTruncOrBitCast(Res, V->getType()));
+ return SCEVUnknown::get(ConstantInt::get(V->getType(), Result));
}
const Type *Ty = V->getType();
@@ -1567,7 +1566,7 @@ SCEVHandle ScalarEvolutionsImpl::ComputeIterationCount(const Loop *L) {
ConstantExpr::getBitCast(CompVal, RealTy));
if (CompVal) {
// Form the constant range.
- ConstantRange CompRange(Cond, CompVal);
+ ConstantRange CompRange(Cond, CompVal->getValue());
SCEVHandle Ret = AddRec->getNumIterationsInRange(CompRange,
false /*Always treat as unsigned range*/);