Lines Matching refs:AddRec

1205   if (const SCEVAddRecExpr *AddRec = dyn_cast<SCEVAddRecExpr>(Op)) {  in getTruncateExpr()  local
1207 for (const SCEV *Op : AddRec->operands()) in getTruncateExpr()
1209 return getAddRecExpr(Operands, AddRec->getLoop(), SCEV::FlagAnyWrap); in getTruncateExpr()
2875 const SCEVAddRecExpr *AddRec = cast<SCEVAddRecExpr>(Ops[Idx]); in getAddExpr() local
2876 const Loop *AddRecLoop = AddRec->getLoop(); in getAddExpr()
2889 LIOps.push_back(AddRec); in getAddExpr()
2894 LIOps.push_back(AddRec->getStart()); in getAddExpr()
2896 SmallVector<const SCEV *, 4> AddRecOps(AddRec->operands()); in getAddExpr()
2920 Flags = AddRec->getNoWrapFlags(setFlags(Flags, SCEV::FlagNW)); in getAddExpr()
2928 if (Ops[i] == AddRec) { in getAddExpr()
2945 AddRec->getLoop()->getHeader()) && in getAddExpr()
2949 SmallVector<const SCEV *, 4> AddRecOps(AddRec->operands()); in getAddExpr()
3199 } else if (const auto *AddRec = dyn_cast<SCEVAddRecExpr>(Ops[1])) { in getMulExpr() local
3202 for (const SCEV *AddRecOp : AddRec->operands()) in getMulExpr()
3211 if (hasFlags(AddRec->getNoWrapFlags(), SCEV::FlagNSW)) { in getMulExpr()
3213 APInt::getSignedMinValue(getTypeSizeInBits(AddRec->getType())); in getMulExpr()
3214 if (getSignedRangeMin(AddRec) != MinInt) in getMulExpr()
3217 return getAddRecExpr(Operands, AddRec->getLoop(), in getMulExpr()
3218 AddRec->getNoWrapFlags(FlagsMask)); in getMulExpr()
3259 const SCEVAddRecExpr *AddRec = cast<SCEVAddRecExpr>(Ops[Idx]); in getMulExpr() local
3261 if (isAvailableAtLoopEntry(Ops[i], AddRec->getLoop())) { in getMulExpr()
3271 NewOps.reserve(AddRec->getNumOperands()); in getMulExpr()
3279 AddRec->getNoWrapFlags(ComputeFlags({Scale, AddRec})); in getMulExpr()
3281 for (unsigned i = 0, e = AddRec->getNumOperands(); i != e; ++i) { in getMulExpr()
3282 NewOps.push_back(getMulExpr(Scale, AddRec->getOperand(i), in getMulExpr()
3289 if (!NSWRegion.contains(getSignedRange(AddRec->getOperand(i)))) in getMulExpr()
3294 const SCEV *NewRec = getAddRecExpr(NewOps, AddRec->getLoop(), Flags); in getMulExpr()
3301 if (Ops[i] == AddRec) { in getMulExpr()
3328 if (!OtherAddRec || OtherAddRec->getLoop() != AddRec->getLoop()) in getMulExpr()
3333 if (AddRec->getNumOperands() + OtherAddRec->getNumOperands() - 1 > in getMulExpr()
3334 MaxAddRecSize || hasHugeExpression({AddRec, OtherAddRec})) in getMulExpr()
3338 Type *Ty = AddRec->getType(); in getMulExpr()
3341 for (int x = 0, xe = AddRec->getNumOperands() + in getMulExpr()
3346 for (int z = std::max(y-x, y-(int)AddRec->getNumOperands()+1), in getMulExpr()
3356 const SCEV *Term1 = AddRec->getOperand(y-z); in getMulExpr()
3367 const SCEV *NewAddRec = getAddRecExpr(AddRecOps, AddRec->getLoop(), in getMulExpr()
3373 AddRec = dyn_cast<SCEVAddRecExpr>(NewAddRec); in getMulExpr()
3374 if (!AddRec) in getMulExpr()
4645 if (auto *AddRec = dyn_cast<SCEVAddRecExpr>(P)) { in removePointerBase() local
4647 SmallVector<const SCEV *> Ops{AddRec->operands()}; in removePointerBase()
4651 return getAddRecExpr(Ops, AddRec->getLoop(), SCEV::FlagAnyWrap); in removePointerBase()
4846 if (auto *AddRec = dyn_cast<SCEVAddRecExpr>(V)) { in getPointerBase() local
4847 V = AddRec->getStart(); in getPointerBase()
6390 void ScalarEvolution::setNoWrapFlags(SCEVAddRecExpr *AddRec, in setNoWrapFlags() argument
6392 if (AddRec->getNoWrapFlags(Flags) != Flags) { in setNoWrapFlags()
6393 AddRec->setNoWrapFlags(Flags); in setNoWrapFlags()
6394 UnsignedRanges.erase(AddRec); in setNoWrapFlags()
6395 SignedRanges.erase(AddRec); in setNoWrapFlags()
6396 ConstantMultipleCache.erase(AddRec); in setNoWrapFlags()
6707 const SCEVAddRecExpr *AddRec = cast<SCEVAddRecExpr>(S); in getRangeRef() local
6710 if (AddRec->hasNoUnsignedWrap()) { in getRangeRef()
6711 APInt UnsignedMinValue = getUnsignedRangeMin(AddRec->getStart()); in getRangeRef()
6722 if (AddRec->hasNoSignedWrap()) { in getRangeRef()
6725 for (unsigned i = 1, e = AddRec->getNumOperands(); i != e; ++i) { in getRangeRef()
6726 if (!isKnownNonNegative(AddRec->getOperand(i))) in getRangeRef()
6728 if (!isKnownNonPositive(AddRec->getOperand(i))) in getRangeRef()
6733 ConstantRange::getNonEmpty(getSignedRangeMin(AddRec->getStart()), in getRangeRef()
6739 getSignedRangeMax(AddRec->getStart()) + in getRangeRef()
6745 if (AddRec->isAffine()) { in getRangeRef()
6747 getConstantMaxBackedgeTakenCount(AddRec->getLoop()); in getRangeRef()
6761 AddRec->getStart(), AddRec->getStepRecurrence(*this), MaxBECount); in getRangeRef()
6766 AddRec->getStart(), AddRec->getStepRecurrence(*this), MaxBECount); in getRangeRef()
6775 getSymbolicMaxBackedgeTakenCount(AddRec->getLoop()); in getRangeRef()
6778 AddRec->hasNoSelfWrap()) { in getRangeRef()
6780 AddRec, SymbolicMaxBECount, BitWidth, SignHint); in getRangeRef()
6787 return setRange(AddRec, SignHint, std::move(ConservativeResult)); in getRangeRef()
7035 const SCEVAddRecExpr *AddRec, const SCEV *MaxBECount, unsigned BitWidth, in getRangeForAffineNoSelfWrappingAR() argument
7037 assert(AddRec->isAffine() && "Non-affine AddRecs are not suppored!\n"); in getRangeForAffineNoSelfWrappingAR()
7038 assert(AddRec->hasNoSelfWrap() && in getRangeForAffineNoSelfWrappingAR()
7041 const SCEV *Step = AddRec->getStepRecurrence(*this); in getRangeForAffineNoSelfWrappingAR()
7051 getTypeSizeInBits(AddRec->getType())) in getRangeForAffineNoSelfWrappingAR()
7053 MaxBECount = getNoopOrZeroExtend(MaxBECount, AddRec->getType()); in getRangeForAffineNoSelfWrappingAR()
7054 const SCEV *RangeWidth = getMinusOne(AddRec->getType()); in getRangeForAffineNoSelfWrappingAR()
7065 const SCEV *End = AddRec->evaluateAtIteration(MaxBECount, *this); in getRangeForAffineNoSelfWrappingAR()
7079 const SCEV *Start = applyLoopGuards(AddRec->getStart(), AddRec->getLoop()); in getRangeForAffineNoSelfWrappingAR()
7239 if (auto *AddRec = dyn_cast<SCEVAddRecExpr>(S)) in getNonTrivialDefiningScopeBound() local
7240 return &*AddRec->getLoop()->getHeader()->begin(); in getNonTrivialDefiningScopeBound()
8493 } else if (auto *AddRec = dyn_cast<SCEVAddRecExpr>(S)) { in forgetLcssaPhiWithNewPredecessor() local
8494 if (L->contains(AddRec->getLoop())) in forgetLcssaPhiWithNewPredecessor()
9118 if (const SCEVAddRecExpr *AddRec = dyn_cast<SCEVAddRecExpr>(LHS)) in computeExitLimitFromICmp() local
9119 if (AddRec->getLoop() == L) { in computeExitLimitFromICmp()
9124 const SCEV *Ret = AddRec->getNumIterationsInRange(CompRange, *this); in computeExitLimitFromICmp()
9255 EvaluateConstantChrecAtConstant(const SCEVAddRecExpr *AddRec, ConstantInt *C, in EvaluateConstantChrecAtConstant() argument
9258 const SCEV *Val = AddRec->evaluateAtIteration(InVal, SE); in EvaluateConstantChrecAtConstant()
9812 auto *AddRec = cast<SCEVAddRecExpr>(S); in getWithOperands() local
9813 return getAddRecExpr(NewOps, AddRec->getLoop(), AddRec->getNoWrapFlags()); in getWithOperands()
9846 const SCEVAddRecExpr *AddRec = cast<SCEVAddRecExpr>(V); in computeSCEVAtScope() local
9850 for (unsigned i = 0, e = AddRec->getNumOperands(); i != e; ++i) { in computeSCEVAtScope()
9851 const SCEV *OpAtScope = getSCEVAtScope(AddRec->getOperand(i), L); in computeSCEVAtScope()
9852 if (OpAtScope == AddRec->getOperand(i)) in computeSCEVAtScope()
9858 NewOps.reserve(AddRec->getNumOperands()); in computeSCEVAtScope()
9859 append_range(NewOps, AddRec->operands().take_front(i)); in computeSCEVAtScope()
9862 NewOps.push_back(getSCEVAtScope(AddRec->getOperand(i), L)); in computeSCEVAtScope()
9865 NewOps, AddRec->getLoop(), AddRec->getNoWrapFlags(SCEV::FlagNW)); in computeSCEVAtScope()
9866 AddRec = dyn_cast<SCEVAddRecExpr>(FoldedRec); in computeSCEVAtScope()
9870 if (!AddRec) in computeSCEVAtScope()
9877 if (!AddRec->getLoop()->contains(L)) { in computeSCEVAtScope()
9880 const SCEV *BackedgeTakenCount = getBackedgeTakenCount(AddRec->getLoop()); in computeSCEVAtScope()
9882 return AddRec; in computeSCEVAtScope()
9885 return AddRec->evaluateAtIteration(BackedgeTakenCount, *this); in computeSCEVAtScope()
9888 return AddRec; in computeSCEVAtScope()
10105 GetQuadraticEquation(const SCEVAddRecExpr *AddRec) { in GetQuadraticEquation() argument
10106 assert(AddRec->getNumOperands() == 3 && "This is not a quadratic chrec!"); in GetQuadraticEquation()
10107 const SCEVConstant *LC = dyn_cast<SCEVConstant>(AddRec->getOperand(0)); in GetQuadraticEquation()
10108 const SCEVConstant *MC = dyn_cast<SCEVConstant>(AddRec->getOperand(1)); in GetQuadraticEquation()
10109 const SCEVConstant *NC = dyn_cast<SCEVConstant>(AddRec->getOperand(2)); in GetQuadraticEquation()
10111 << *AddRec << '\n'); in GetQuadraticEquation()
10207 SolveQuadraticAddRecExact(const SCEVAddRecExpr *AddRec, ScalarEvolution &SE) { in SolveQuadraticAddRecExact() argument
10210 auto T = GetQuadraticEquation(AddRec); in SolveQuadraticAddRecExact()
10222 ConstantInt *V = EvaluateConstantChrecAtConstant(AddRec, CX, SE); in SolveQuadraticAddRecExact()
10240 SolveQuadraticAddRecRange(const SCEVAddRecExpr *AddRec, in SolveQuadraticAddRecRange() argument
10242 assert(AddRec->getOperand(0)->isZero() && in SolveQuadraticAddRecRange()
10245 << Range << ", addrec " << *AddRec << '\n'); in SolveQuadraticAddRecRange()
10248 assert(Range.contains(APInt(SE.getTypeSizeInBits(AddRec->getType()), 0)) && in SolveQuadraticAddRecRange()
10253 auto T = GetQuadraticEquation(AddRec); in SolveQuadraticAddRecRange()
10286 ConstantInt *V0 = EvaluateConstantChrecAtConstant(AddRec, C0, SE); in SolveQuadraticAddRecRange()
10291 ConstantInt *V1 = EvaluateConstantChrecAtConstant(AddRec, C1, SE); in SolveQuadraticAddRecRange()
10386 const SCEVAddRecExpr *AddRec = in howFarToZero() local
10389 if (!AddRec && AllowPredicates) in howFarToZero()
10393 AddRec = convertSCEVToAddRecWithPredicates(V, L, Predicates); in howFarToZero()
10395 if (!AddRec || AddRec->getLoop() != L) in howFarToZero()
10400 if (AddRec->isQuadratic() && AddRec->getType()->isIntegerTy()) { in howFarToZero()
10404 if (auto S = SolveQuadraticAddRecExact(AddRec, *this)) { in howFarToZero()
10412 if (!AddRec->isAffine()) in howFarToZero()
10427 const SCEV *Start = getSCEVAtScope(AddRec->getStart(), L->getParentLoop()); in howFarToZero()
10428 const SCEV *Step = getSCEVAtScope(AddRec->getOperand(1), L->getParentLoop()); in howFarToZero()
10480 if (ControlsOnlyExit && AddRec->hasNoSelfWrap() && in howFarToZero()
10481 loopHasNoAbnormalExits(AddRec->getLoop())) { in howFarToZero()
14568 auto *AddRec = dyn_cast<SCEVAddRecExpr>(S); in convertSCEVToAddRecWithPredicates() local
14570 if (!AddRec) in convertSCEVToAddRecWithPredicates()
14578 return AddRec; in convertSCEVToAddRecWithPredicates()