aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Analysis
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2006-12-12 05:05:00 +0000
committerReid Spencer <rspencer@reidspencer.com>2006-12-12 05:05:00 +0000
commit4da49122f3f3c8da68a52723d846b88c72166a68 (patch)
treea7cb69a70439f795df63c88c5d56200e3ae17be6 /lib/Analysis
parenta30fc5ed0430081f6495b33e027b7655ca2a66e5 (diff)
downloadexternal_llvm-4da49122f3f3c8da68a52723d846b88c72166a68.zip
external_llvm-4da49122f3f3c8da68a52723d846b88c72166a68.tar.gz
external_llvm-4da49122f3f3c8da68a52723d846b88c72166a68.tar.bz2
Change inferred getCast into specific getCast. Passes all tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32469 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis')
-rw-r--r--lib/Analysis/ScalarEvolution.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp
index 6d449d0..703a1c4 100644
--- a/lib/Analysis/ScalarEvolution.cpp
+++ b/lib/Analysis/ScalarEvolution.cpp
@@ -1566,7 +1566,9 @@ SCEVHandle ScalarEvolutionsImpl::ComputeIterationCount(const Loop *L) {
// comparison.
ConstantInt *CompVal = RHSC->getValue();
const Type *RealTy = ExitCond->getOperand(0)->getType();
- CompVal = dyn_cast<ConstantInt>(ConstantExpr::getCast(CompVal, RealTy));
+ CompVal = dyn_cast<ConstantInt>(
+ ConstantExpr::getIntegerCast(CompVal, RealTy,
+ CompVal->getType()->isSigned()));
if (CompVal) {
// Form the constant range.
ConstantRange CompRange(Cond, CompVal);
@@ -1575,8 +1577,12 @@ SCEVHandle ScalarEvolutionsImpl::ComputeIterationCount(const Loop *L) {
// range.
if (CompRange.getLower()->getType()->isSigned()) {
const Type *NewTy = RHSC->getValue()->getType();
- Constant *NewL = ConstantExpr::getCast(CompRange.getLower(), NewTy);
- Constant *NewU = ConstantExpr::getCast(CompRange.getUpper(), NewTy);
+ Constant *NewL =
+ ConstantExpr::getIntegerCast(CompRange.getLower(), NewTy,
+ CompRange.getLower()->getType()->isSigned());
+ Constant *NewU =
+ ConstantExpr::getIntegerCast(CompRange.getUpper(), NewTy,
+ CompRange.getUpper()->getType()->isSigned());
CompRange = ConstantRange(NewL, NewU);
}