diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2006-12-12 23:36:14 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2006-12-12 23:36:14 +0000 |
commit | d977d8651a5cd26a3e1088267f31cade405f2adf (patch) | |
tree | 56a269fe411951fa288d6a08c32f3d74b8bf8794 /lib/Analysis/ScalarEvolution.cpp | |
parent | ebc0922eeb5b728d33a68d4bea8128413f62e369 (diff) |
Replace inferred getCast(V,Ty) calls with more strict variants.
Rename getZeroExtend and getSignExtend to getZExt and getSExt to match
the the casting mnemonics in the rest of LLVM.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32514 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/ScalarEvolution.cpp')
-rw-r--r-- | lib/Analysis/ScalarEvolution.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp index 46b8f2629c..7d73d7d398 100644 --- a/lib/Analysis/ScalarEvolution.cpp +++ b/lib/Analysis/ScalarEvolution.cpp @@ -584,7 +584,7 @@ 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::getZeroExtend(SC->getValue(), Ty)); + ConstantExpr::getZExt(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 @@ -2000,11 +2000,14 @@ SCEVHandle ScalarEvolutionsImpl::getSCEVAtScope(SCEV *V, const Loop *L) { } else { SCEVHandle OpV = getSCEVAtScope(getSCEV(Op), L); if (SCEVConstant *SC = dyn_cast<SCEVConstant>(OpV)) - Operands.push_back(ConstantExpr::getCast(SC->getValue(), - Op->getType())); + Operands.push_back(ConstantExpr::getIntegerCast(SC->getValue(), + Op->getType(), + false)); else if (SCEVUnknown *SU = dyn_cast<SCEVUnknown>(OpV)) { if (Constant *C = dyn_cast<Constant>(SU->getValue())) - Operands.push_back(ConstantExpr::getCast(C, Op->getType())); + Operands.push_back(ConstantExpr::getIntegerCast(C, + Op->getType(), + false)); else return V; } else { @@ -2122,7 +2125,7 @@ SolveQuadraticEquation(const SCEVAddRecExpr *AddRec) { // Compute floor(sqrt(B^2-4ac)) ConstantInt *SqrtVal = - cast<ConstantInt>(ConstantExpr::getCast(SqrtTerm, + cast<ConstantInt>(ConstantExpr::getBitCast(SqrtTerm, SqrtTerm->getType()->getUnsignedVersion())); uint64_t SqrtValV = SqrtVal->getZExtValue(); uint64_t SqrtValV2 = (uint64_t)sqrt((double)SqrtValV); @@ -2135,16 +2138,16 @@ SolveQuadraticEquation(const SCEVAddRecExpr *AddRec) { } SqrtVal = ConstantInt::get(Type::ULongTy, SqrtValV2); - SqrtTerm = ConstantExpr::getCast(SqrtVal, SqrtTerm->getType()); + SqrtTerm = ConstantExpr::getTruncOrBitCast(SqrtVal, SqrtTerm->getType()); Constant *NegB = ConstantExpr::getNeg(B); Constant *TwoA = ConstantExpr::getMul(A, Two); // The divisions must be performed as signed divisions. const Type *SignedTy = NegB->getType()->getSignedVersion(); - NegB = ConstantExpr::getCast(NegB, SignedTy); - TwoA = ConstantExpr::getCast(TwoA, SignedTy); - SqrtTerm = ConstantExpr::getCast(SqrtTerm, SignedTy); + NegB = ConstantExpr::getBitCast(NegB, SignedTy); + TwoA = ConstantExpr::getBitCast(TwoA, SignedTy); + SqrtTerm = ConstantExpr::getBitCast(SqrtTerm, SignedTy); Constant *Solution1 = ConstantExpr::getSDiv(ConstantExpr::getAdd(NegB, SqrtTerm), TwoA); |