diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2006-12-12 05:05:00 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2006-12-12 05:05:00 +0000 |
commit | 4da49122f3f3c8da68a52723d846b88c72166a68 (patch) | |
tree | a7cb69a70439f795df63c88c5d56200e3ae17be6 /lib/Analysis/ScalarEvolution.cpp | |
parent | a30fc5ed0430081f6495b33e027b7655ca2a66e5 (diff) |
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/ScalarEvolution.cpp')
-rw-r--r-- | lib/Analysis/ScalarEvolution.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp index 6d449d0d92..703a1c46e9 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); } |