X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FAnalysis%2FScalarEvolutionExpander.cpp;h=59f19a002eccc9fc4a51106a1a71afdf8a9eae06;hb=b499b73e3019fca9bf93b448e25c25fffe95562a;hp=ef9557132fcf29b2376d201f723061f5a4885af6;hpb=09d756a7e0b263154d410f9a52dd54850d576427;p=oota-llvm.git diff --git a/lib/Analysis/ScalarEvolutionExpander.cpp b/lib/Analysis/ScalarEvolutionExpander.cpp index ef9557132fc..59f19a002ec 100644 --- a/lib/Analysis/ScalarEvolutionExpander.cpp +++ b/lib/Analysis/ScalarEvolutionExpander.cpp @@ -1063,34 +1063,6 @@ static bool canBeCheaplyTransformed(ScalarEvolution &SE, return false; } -static bool IsIncrementNSW(ScalarEvolution &SE, const SCEVAddRecExpr *AR) { - if (!isa(AR->getType())) - return false; - - unsigned BitWidth = cast(AR->getType())->getBitWidth(); - Type *WideTy = IntegerType::get(AR->getType()->getContext(), BitWidth * 2); - const SCEV *Step = AR->getStepRecurrence(SE); - const SCEV *OpAfterExtend = SE.getAddExpr(SE.getSignExtendExpr(Step, WideTy), - SE.getSignExtendExpr(AR, WideTy)); - const SCEV *ExtendAfterOp = - SE.getSignExtendExpr(SE.getAddExpr(AR, Step), WideTy); - return ExtendAfterOp == OpAfterExtend; -} - -static bool IsIncrementNUW(ScalarEvolution &SE, const SCEVAddRecExpr *AR) { - if (!isa(AR->getType())) - return false; - - unsigned BitWidth = cast(AR->getType())->getBitWidth(); - Type *WideTy = IntegerType::get(AR->getType()->getContext(), BitWidth * 2); - const SCEV *Step = AR->getStepRecurrence(SE); - const SCEV *OpAfterExtend = SE.getAddExpr(SE.getZeroExtendExpr(Step, WideTy), - SE.getZeroExtendExpr(AR, WideTy)); - const SCEV *ExtendAfterOp = - SE.getZeroExtendExpr(SE.getAddExpr(AR, Step), WideTy); - return ExtendAfterOp == OpAfterExtend; -} - /// getAddRecExprPHILiterally - Helper for expandAddRecExprLiterally. Expand /// the base addrec, which is the addrec without any non-loop-dominating /// values, and return the PHI. @@ -1241,11 +1213,10 @@ SCEVExpander::getAddRecExprPHILiterally(const SCEVAddRecExpr *Normalized, IVIncInsertPos : Pred->getTerminator(); Builder.SetInsertPoint(InsertPos); Value *IncV = expandIVInc(PN, StepV, L, ExpandTy, IntTy, useSubtract); - if (isa(IncV)) { - if (IsIncrementNUW(SE, Normalized)) + if (Normalized->getNoWrapFlags(SCEV::FlagNUW)) cast(IncV)->setHasNoUnsignedWrap(); - if (IsIncrementNSW(SE, Normalized)) + if (Normalized->getNoWrapFlags(SCEV::FlagNSW)) cast(IncV)->setHasNoSignedWrap(); } PN->addIncoming(IncV, Pred);