diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2007-02-28 18:57:32 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2007-02-28 18:57:32 +0000 |
commit | 56f784d12d00a0a9d93c9ef860141e0595d31828 (patch) | |
tree | a1b30ce625dffbe464766e692ec09de15f1d4c37 /llvm/lib/Analysis/ScalarEvolution.cpp | |
parent | 440995bd9a9f19ff152798a841c3621293b6738b (diff) | |
download | bcm5719-llvm-56f784d12d00a0a9d93c9ef860141e0595d31828.tar.gz bcm5719-llvm-56f784d12d00a0a9d93c9ef860141e0595d31828.zip |
For PR1205:
First round of ConstantRange changes. This makes all CR constructors use
only APInt and not use ConstantInt. Clients are adjusted accordingly.
llvm-svn: 34756
Diffstat (limited to 'llvm/lib/Analysis/ScalarEvolution.cpp')
-rw-r--r-- | llvm/lib/Analysis/ScalarEvolution.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp index a81f24f117f..0507b39b7d9 100644 --- a/llvm/lib/Analysis/ScalarEvolution.cpp +++ b/llvm/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*/); |