summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2006-12-04 17:05:42 +0000
committerReid Spencer <rspencer@reidspencer.com>2006-12-04 17:05:42 +0000
commit1ba24bb1e47b23bc64dab005a92293f555f06098 (patch)
tree52a1b3f7a2b9dcd60e8562fe7cdd2ba78af3185a /llvm/lib/Analysis
parent561bb367563eff4a7c2f3dfed15976b0d5a891df (diff)
downloadbcm5719-llvm-1ba24bb1e47b23bc64dab005a92293f555f06098.tar.gz
bcm5719-llvm-1ba24bb1e47b23bc64dab005a92293f555f06098.zip
Fix inferred casts.
llvm-svn: 32180
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r--llvm/lib/Analysis/ScalarEvolution.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index 87232b371ce..52d9410b340 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -178,7 +178,8 @@ SCEVHandle SCEVConstant::get(ConstantInt *V) {
// Make sure that SCEVConstant instances are all unsigned.
if (V->getType()->isSigned()) {
const Type *NewTy = V->getType()->getUnsignedVersion();
- V = cast<ConstantInt>(ConstantExpr::getCast(V, NewTy));
+ V = cast<ConstantInt>(
+ ConstantExpr::getInferredCast(V, false, NewTy, false));
}
SCEVConstant *&R = (*SCEVConstants)[V];
@@ -465,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::getCast(C, Ty);
+ C = ConstantExpr::getInferredCast(C, true, Ty, false);
}
return SCEVUnknown::get(C);
}
@@ -511,7 +512,8 @@ static SCEVHandle PartialFact(SCEVHandle V, unsigned NumSteps) {
for (; NumSteps; --NumSteps)
Result *= Val-(NumSteps-1);
Constant *Res = ConstantInt::get(Type::ULongTy, Result);
- return SCEVUnknown::get(ConstantExpr::getCast(Res, V->getType()));
+ return SCEVUnknown::get(
+ ConstantExpr::getInferredCast(Res, false, V->getType(), true));
}
const Type *Ty = V->getType();
@@ -996,10 +998,11 @@ SCEVHandle SCEVSDivExpr::get(const SCEVHandle &LHS, const SCEVHandle &RHS) {
Constant *LHSCV = LHSC->getValue();
Constant *RHSCV = RHSC->getValue();
if (LHSCV->getType()->isUnsigned())
- LHSCV = ConstantExpr::getCast(LHSCV,
- LHSCV->getType()->getSignedVersion());
+ LHSCV = ConstantExpr::getInferredCast(
+ LHSCV, false, LHSCV->getType()->getSignedVersion(), true);
if (RHSCV->getType()->isUnsigned())
- RHSCV = ConstantExpr::getCast(RHSCV, LHSCV->getType());
+ RHSCV = ConstantExpr::getInferredCast(
+ RHSCV, false, LHSCV->getType(), true);
return SCEVUnknown::get(ConstantExpr::getSDiv(LHSCV, RHSCV));
}
}
OpenPOWER on IntegriCloud