Changes in directory llvm/lib/Analysis:
ScalarEvolution.cpp updated: 1.53.2.2 -> 1.53.2.3 --- Log message: Initial patch for DIV -> SDIV/UDIV --- Diffs of the changes: (+13 -13) ScalarEvolution.cpp | 26 +++++++++++++------------- 1 files changed, 13 insertions(+), 13 deletions(-) Index: llvm/lib/Analysis/ScalarEvolution.cpp diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.53.2.2 llvm/lib/Analysis/ScalarEvolution.cpp:1.53.2.3 --- llvm/lib/Analysis/ScalarEvolution.cpp:1.53.2.2 Thu Oct 19 19:34:43 2006 +++ llvm/lib/Analysis/ScalarEvolution.cpp Thu Oct 19 23:27:17 2006 @@ -989,9 +989,9 @@ SCEVHandle SCEVSDivExpr::get(const SCEVHandle &LHS, const SCEVHandle &RHS) { if (SCEVConstant *RHSC = dyn_cast<SCEVConstant>(RHS)) { if (RHSC->getValue()->equalsInt(1)) - return LHS; // X /s 1 --> x + return LHS; // X sdiv 1 --> x if (RHSC->getValue()->isAllOnesValue()) - return SCEV::getNegativeSCEV(LHS); // X /s -1 --> -x + return SCEV::getNegativeSCEV(LHS); // X sdiv -1 --> -x if (SCEVConstant *LHSC = dyn_cast<SCEVConstant>(LHS)) { Constant *LHSCV = LHSC->getValue(); @@ -1001,7 +1001,7 @@ LHSCV->getType()->getSignedVersion()); if (RHSCV->getType()->isUnsigned()) RHSCV = ConstantExpr::getCast(RHSCV, LHSCV->getType()); - return SCEVUnknown::get(ConstantExpr::getDiv(LHSCV, RHSCV)); + return SCEVUnknown::get(ConstantExpr::getSDiv(LHSCV, RHSCV)); } } @@ -1384,8 +1384,8 @@ case Instruction::Mul: return SCEVMulExpr::get(getSCEV(I->getOperand(0)), getSCEV(I->getOperand(1))); - case Instruction::Div: - if (V->getType()->isInteger() && V->getType()->isSigned()) + case Instruction::SDiv: + if (V->getType()->isInteger()) return SCEVSDivExpr::get(getSCEV(I->getOperand(0)), getSCEV(I->getOperand(1))); break; @@ -2058,16 +2058,16 @@ return std::make_pair(CNC, CNC); } - Constant *Two = ConstantInt::get(L->getValue()->getType(), 2); + Constant *C = L->getValue(); + Constant *Two = ConstantInt::get(C->getType(), 2); // Convert from chrec coefficients to polynomial coefficients AX^2+BX+C - Constant *C = L->getValue(); // The B coefficient is M-N/2 Constant *B = ConstantExpr::getSub(M->getValue(), - ConstantExpr::getDiv(N->getValue(), + ConstantExpr::getSDiv(N->getValue(), Two)); // The A coefficient is N/2 - Constant *A = ConstantExpr::getDiv(N->getValue(), Two); + Constant *A = ConstantExpr::getSDiv(N->getValue(), Two); // Compute the B^2-4ac term. Constant *SqrtTerm = @@ -2102,9 +2102,9 @@ SqrtTerm = ConstantExpr::getCast(SqrtTerm, SignedTy); Constant *Solution1 = - ConstantExpr::getDiv(ConstantExpr::getAdd(NegB, SqrtTerm), TwoA); + ConstantExpr::getSDiv(ConstantExpr::getAdd(NegB, SqrtTerm), TwoA); Constant *Solution2 = - ConstantExpr::getDiv(ConstantExpr::getSub(NegB, SqrtTerm), TwoA); + ConstantExpr::getSDiv(ConstantExpr::getSub(NegB, SqrtTerm), TwoA); return std::make_pair(SCEVUnknown::get(Solution1), SCEVUnknown::get(Solution2)); } @@ -2150,7 +2150,7 @@ Constant *StartNegC = ConstantExpr::getNeg(StartCC); Constant *Rem = ConstantExpr::getRem(StartNegC, StepC->getValue()); if (Rem->isNullValue()) { - Constant *Result =ConstantExpr::getDiv(StartNegC,StepC->getValue()); + Constant *Result =ConstantExpr::getSDiv(StartNegC,StepC->getValue()); return SCEVUnknown::get(Result); } } @@ -2352,7 +2352,7 @@ Constant *ExitValue = Upper; if (A != One) { ExitValue = ConstantExpr::getSub(ConstantExpr::getAdd(Upper, A), One); - ExitValue = ConstantExpr::getDiv(ExitValue, A); + ExitValue = ConstantExpr::getSDiv(ExitValue, A); } assert(isa<ConstantInt>(ExitValue) && "Constant folding of integers not implemented?"); _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits