From 04710becf553b75b95e54bc5897e1a44cd56dfea Mon Sep 17 00:00:00 2001 From: Reid Spencer Date: Tue, 12 Dec 2006 09:17:50 +0000 Subject: [PATCH] Get even more accurate on the casting. llvm-svn: 32478 --- lib/Analysis/ScalarEvolution.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp index 703a1c46e9a..46b8f2629c3 100644 --- a/lib/Analysis/ScalarEvolution.cpp +++ b/lib/Analysis/ScalarEvolution.cpp @@ -1567,8 +1567,7 @@ SCEVHandle ScalarEvolutionsImpl::ComputeIterationCount(const Loop *L) { ConstantInt *CompVal = RHSC->getValue(); const Type *RealTy = ExitCond->getOperand(0)->getType(); CompVal = dyn_cast( - ConstantExpr::getIntegerCast(CompVal, RealTy, - CompVal->getType()->isSigned())); + ConstantExpr::getBitCast(CompVal, RealTy)); if (CompVal) { // Form the constant range. ConstantRange CompRange(Cond, CompVal); @@ -1577,12 +1576,10 @@ SCEVHandle ScalarEvolutionsImpl::ComputeIterationCount(const Loop *L) { // range. if (CompRange.getLower()->getType()->isSigned()) { const Type *NewTy = RHSC->getValue()->getType(); - Constant *NewL = - ConstantExpr::getIntegerCast(CompRange.getLower(), NewTy, - CompRange.getLower()->getType()->isSigned()); - Constant *NewU = - ConstantExpr::getIntegerCast(CompRange.getUpper(), NewTy, - CompRange.getUpper()->getType()->isSigned()); + Constant *NewL = ConstantExpr::getBitCast(CompRange.getLower(), + NewTy); + Constant *NewU = ConstantExpr::getBitCast(CompRange.getUpper(), + NewTy); CompRange = ConstantRange(NewL, NewU); }