aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/ScalarEvolution.cpp
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2006-12-05 19:14:13 +0000
committerReid Spencer <rspencer@reidspencer.com>2006-12-05 19:14:13 +0000
commit7858b336f23405a96ee25de1b9071aeaf270bd77 (patch)
tree11debcd684c0fb87a92b18ce464d9e0b81b81b45 /lib/Analysis/ScalarEvolution.cpp
parentf3597a13ae66dbe682029f64fb1a7f2b65ff6536 (diff)
Bail on the getInferredCast idea. Remove the function and convert
remaining uses to more specific casts. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32231 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/ScalarEvolution.cpp')
-rw-r--r--lib/Analysis/ScalarEvolution.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp
index 6f75fa0f0e..4c1fa10cc8 100644
--- a/lib/Analysis/ScalarEvolution.cpp
+++ b/lib/Analysis/ScalarEvolution.cpp
@@ -179,7 +179,7 @@ SCEVHandle SCEVConstant::get(ConstantInt *V) {
if (V->getType()->isSigned()) {
const Type *NewTy = V->getType()->getUnsignedVersion();
V = cast<ConstantInt>(
- ConstantExpr::getInferredCast(V, false, NewTy, false));
+ ConstantExpr::getBitCast(V, NewTy));
}
SCEVConstant *&R = (*SCEVConstants)[V];
@@ -466,7 +466,7 @@ SCEVHandle SCEVUnknown::getIntegerSCEV(int Val, const Type *Ty) {
C = ConstantInt::get(Ty, Val);
else {
C = ConstantInt::get(Ty->getSignedVersion(), Val);
- C = ConstantExpr::getInferredCast(C, true, Ty, false);
+ C = ConstantExpr::getBitCast(C, Ty);
}
return SCEVUnknown::get(C);
}
@@ -513,7 +513,7 @@ static SCEVHandle PartialFact(SCEVHandle V, unsigned NumSteps) {
Result *= Val-(NumSteps-1);
Constant *Res = ConstantInt::get(Type::ULongTy, Result);
return SCEVUnknown::get(
- ConstantExpr::getInferredCast(Res, false, V->getType(), true));
+ ConstantExpr::getTruncOrBitCast(Res, V->getType()));
}
const Type *Ty = V->getType();
@@ -559,7 +559,8 @@ SCEVHandle SCEVAddRecExpr::evaluateAtIteration(SCEVHandle It) const {
SCEVHandle SCEVTruncateExpr::get(const SCEVHandle &Op, const Type *Ty) {
if (SCEVConstant *SC = dyn_cast<SCEVConstant>(Op))
- return SCEVUnknown::get(ConstantExpr::getCast(SC->getValue(), Ty));
+ return SCEVUnknown::get(
+ ConstantExpr::getTruncOrBitCast(SC->getValue(), Ty));
// If the input value is a chrec scev made out of constants, truncate
// all of the constants.
@@ -582,7 +583,8 @@ SCEVHandle SCEVTruncateExpr::get(const SCEVHandle &Op, const Type *Ty) {
SCEVHandle SCEVZeroExtendExpr::get(const SCEVHandle &Op, const Type *Ty) {
if (SCEVConstant *SC = dyn_cast<SCEVConstant>(Op))
- return SCEVUnknown::get(ConstantExpr::getCast(SC->getValue(), Ty));
+ return SCEVUnknown::get(
+ ConstantExpr::getZExtOrBitCast(SC->getValue(), Ty));
// FIXME: If the input value is a chrec scev, and we can prove that the value
// did not overflow the old, smaller, value, we can zero extend all of the
@@ -998,11 +1000,10 @@ SCEVHandle SCEVSDivExpr::get(const SCEVHandle &LHS, const SCEVHandle &RHS) {
Constant *LHSCV = LHSC->getValue();
Constant *RHSCV = RHSC->getValue();
if (LHSCV->getType()->isUnsigned())
- LHSCV = ConstantExpr::getInferredCast(
- LHSCV, false, LHSCV->getType()->getSignedVersion(), true);
+ LHSCV = ConstantExpr::getBitCast(LHSCV,
+ LHSCV->getType()->getSignedVersion());
if (RHSCV->getType()->isUnsigned())
- RHSCV = ConstantExpr::getInferredCast(
- RHSCV, false, LHSCV->getType(), true);
+ RHSCV = ConstantExpr::getBitCast(RHSCV, LHSCV->getType());
return SCEVUnknown::get(ConstantExpr::getSDiv(LHSCV, RHSCV));
}
}