Lines Matching refs:AddRec

1207   if (const SCEVAddRecExpr *AddRec = dyn_cast<SCEVAddRecExpr>(Op)) {  in getTruncateExpr()  local
1209 for (const SCEV *Op : AddRec->operands()) in getTruncateExpr()
1211 return getAddRecExpr(Operands, AddRec->getLoop(), SCEV::FlagAnyWrap); in getTruncateExpr()
2877 const SCEVAddRecExpr *AddRec = cast<SCEVAddRecExpr>(Ops[Idx]); in getAddExpr() local
2878 const Loop *AddRecLoop = AddRec->getLoop(); in getAddExpr()
2891 LIOps.push_back(AddRec); in getAddExpr()
2896 LIOps.push_back(AddRec->getStart()); in getAddExpr()
2898 SmallVector<const SCEV *, 4> AddRecOps(AddRec->operands()); in getAddExpr()
2922 Flags = AddRec->getNoWrapFlags(setFlags(Flags, SCEV::FlagNW)); in getAddExpr()
2930 if (Ops[i] == AddRec) { in getAddExpr()
2947 AddRec->getLoop()->getHeader()) && in getAddExpr()
2951 SmallVector<const SCEV *, 4> AddRecOps(AddRec->operands()); in getAddExpr()
3201 } else if (const auto *AddRec = dyn_cast<SCEVAddRecExpr>(Ops[1])) { in getMulExpr() local
3204 for (const SCEV *AddRecOp : AddRec->operands()) in getMulExpr()
3213 if (hasFlags(AddRec->getNoWrapFlags(), SCEV::FlagNSW)) { in getMulExpr()
3215 APInt::getSignedMinValue(getTypeSizeInBits(AddRec->getType())); in getMulExpr()
3216 if (getSignedRangeMin(AddRec) != MinInt) in getMulExpr()
3219 return getAddRecExpr(Operands, AddRec->getLoop(), in getMulExpr()
3220 AddRec->getNoWrapFlags(FlagsMask)); in getMulExpr()
3261 const SCEVAddRecExpr *AddRec = cast<SCEVAddRecExpr>(Ops[Idx]); in getMulExpr() local
3263 if (isAvailableAtLoopEntry(Ops[i], AddRec->getLoop())) { in getMulExpr()
3273 NewOps.reserve(AddRec->getNumOperands()); in getMulExpr()
3281 AddRec->getNoWrapFlags(ComputeFlags({Scale, AddRec})); in getMulExpr()
3283 for (unsigned i = 0, e = AddRec->getNumOperands(); i != e; ++i) { in getMulExpr()
3284 NewOps.push_back(getMulExpr(Scale, AddRec->getOperand(i), in getMulExpr()
3291 if (!NSWRegion.contains(getSignedRange(AddRec->getOperand(i)))) in getMulExpr()
3296 const SCEV *NewRec = getAddRecExpr(NewOps, AddRec->getLoop(), Flags); in getMulExpr()
3303 if (Ops[i] == AddRec) { in getMulExpr()
3330 if (!OtherAddRec || OtherAddRec->getLoop() != AddRec->getLoop()) in getMulExpr()
3335 if (AddRec->getNumOperands() + OtherAddRec->getNumOperands() - 1 > in getMulExpr()
3336 MaxAddRecSize || hasHugeExpression({AddRec, OtherAddRec})) in getMulExpr()
3340 Type *Ty = AddRec->getType(); in getMulExpr()
3343 for (int x = 0, xe = AddRec->getNumOperands() + in getMulExpr()
3348 for (int z = std::max(y-x, y-(int)AddRec->getNumOperands()+1), in getMulExpr()
3358 const SCEV *Term1 = AddRec->getOperand(y-z); in getMulExpr()
3369 const SCEV *NewAddRec = getAddRecExpr(AddRecOps, AddRec->getLoop(), in getMulExpr()
3375 AddRec = dyn_cast<SCEVAddRecExpr>(NewAddRec); in getMulExpr()
3376 if (!AddRec) in getMulExpr()
4650 if (auto *AddRec = dyn_cast<SCEVAddRecExpr>(P)) { in removePointerBase() local
4652 SmallVector<const SCEV *> Ops{AddRec->operands()}; in removePointerBase()
4656 return getAddRecExpr(Ops, AddRec->getLoop(), SCEV::FlagAnyWrap); in removePointerBase()
4851 if (auto *AddRec = dyn_cast<SCEVAddRecExpr>(V)) { in getPointerBase() local
4852 V = AddRec->getStart(); in getPointerBase()
6406 void ScalarEvolution::setNoWrapFlags(SCEVAddRecExpr *AddRec, in setNoWrapFlags() argument
6408 if (AddRec->getNoWrapFlags(Flags) != Flags) { in setNoWrapFlags()
6409 AddRec->setNoWrapFlags(Flags); in setNoWrapFlags()
6410 UnsignedRanges.erase(AddRec); in setNoWrapFlags()
6411 SignedRanges.erase(AddRec); in setNoWrapFlags()
6412 ConstantMultipleCache.erase(AddRec); in setNoWrapFlags()
6723 const SCEVAddRecExpr *AddRec = cast<SCEVAddRecExpr>(S); in getRangeRef() local
6726 if (AddRec->hasNoUnsignedWrap()) { in getRangeRef()
6727 APInt UnsignedMinValue = getUnsignedRangeMin(AddRec->getStart()); in getRangeRef()
6738 if (AddRec->hasNoSignedWrap()) { in getRangeRef()
6741 for (unsigned i = 1, e = AddRec->getNumOperands(); i != e; ++i) { in getRangeRef()
6742 if (!isKnownNonNegative(AddRec->getOperand(i))) in getRangeRef()
6744 if (!isKnownNonPositive(AddRec->getOperand(i))) in getRangeRef()
6749 ConstantRange::getNonEmpty(getSignedRangeMin(AddRec->getStart()), in getRangeRef()
6755 getSignedRangeMax(AddRec->getStart()) + in getRangeRef()
6761 if (AddRec->isAffine()) { in getRangeRef()
6763 getConstantMaxBackedgeTakenCount(AddRec->getLoop()); in getRangeRef()
6777 AddRec->getStart(), AddRec->getStepRecurrence(*this), MaxBECount); in getRangeRef()
6782 AddRec->getStart(), AddRec->getStepRecurrence(*this), MaxBECount); in getRangeRef()
6791 getSymbolicMaxBackedgeTakenCount(AddRec->getLoop()); in getRangeRef()
6794 AddRec->hasNoSelfWrap()) { in getRangeRef()
6796 AddRec, SymbolicMaxBECount, BitWidth, SignHint); in getRangeRef()
6803 return setRange(AddRec, SignHint, std::move(ConservativeResult)); in getRangeRef()
7051 const SCEVAddRecExpr *AddRec, const SCEV *MaxBECount, unsigned BitWidth, in getRangeForAffineNoSelfWrappingAR() argument
7053 assert(AddRec->isAffine() && "Non-affine AddRecs are not suppored!\n"); in getRangeForAffineNoSelfWrappingAR()
7054 assert(AddRec->hasNoSelfWrap() && in getRangeForAffineNoSelfWrappingAR()
7057 const SCEV *Step = AddRec->getStepRecurrence(*this); in getRangeForAffineNoSelfWrappingAR()
7067 getTypeSizeInBits(AddRec->getType())) in getRangeForAffineNoSelfWrappingAR()
7069 MaxBECount = getNoopOrZeroExtend(MaxBECount, AddRec->getType()); in getRangeForAffineNoSelfWrappingAR()
7070 const SCEV *RangeWidth = getMinusOne(AddRec->getType()); in getRangeForAffineNoSelfWrappingAR()
7081 const SCEV *End = AddRec->evaluateAtIteration(MaxBECount, *this); in getRangeForAffineNoSelfWrappingAR()
7095 const SCEV *Start = applyLoopGuards(AddRec->getStart(), AddRec->getLoop()); in getRangeForAffineNoSelfWrappingAR()
7255 if (auto *AddRec = dyn_cast<SCEVAddRecExpr>(S)) in getNonTrivialDefiningScopeBound() local
7256 return &*AddRec->getLoop()->getHeader()->begin(); in getNonTrivialDefiningScopeBound()
8514 } else if (auto *AddRec = dyn_cast<SCEVAddRecExpr>(S)) { in forgetLcssaPhiWithNewPredecessor() local
8515 if (L->contains(AddRec->getLoop())) in forgetLcssaPhiWithNewPredecessor()
9162 if (const SCEVAddRecExpr *AddRec = dyn_cast<SCEVAddRecExpr>(LHS)) in computeExitLimitFromICmp() local
9163 if (AddRec->getLoop() == L) { in computeExitLimitFromICmp()
9168 const SCEV *Ret = AddRec->getNumIterationsInRange(CompRange, *this); in computeExitLimitFromICmp()
9316 EvaluateConstantChrecAtConstant(const SCEVAddRecExpr *AddRec, ConstantInt *C, in EvaluateConstantChrecAtConstant() argument
9319 const SCEV *Val = AddRec->evaluateAtIteration(InVal, SE); in EvaluateConstantChrecAtConstant()
9874 auto *AddRec = cast<SCEVAddRecExpr>(S); in getWithOperands() local
9875 return getAddRecExpr(NewOps, AddRec->getLoop(), AddRec->getNoWrapFlags()); in getWithOperands()
9908 const SCEVAddRecExpr *AddRec = cast<SCEVAddRecExpr>(V); in computeSCEVAtScope() local
9912 for (unsigned i = 0, e = AddRec->getNumOperands(); i != e; ++i) { in computeSCEVAtScope()
9913 const SCEV *OpAtScope = getSCEVAtScope(AddRec->getOperand(i), L); in computeSCEVAtScope()
9914 if (OpAtScope == AddRec->getOperand(i)) in computeSCEVAtScope()
9920 NewOps.reserve(AddRec->getNumOperands()); in computeSCEVAtScope()
9921 append_range(NewOps, AddRec->operands().take_front(i)); in computeSCEVAtScope()
9924 NewOps.push_back(getSCEVAtScope(AddRec->getOperand(i), L)); in computeSCEVAtScope()
9927 NewOps, AddRec->getLoop(), AddRec->getNoWrapFlags(SCEV::FlagNW)); in computeSCEVAtScope()
9928 AddRec = dyn_cast<SCEVAddRecExpr>(FoldedRec); in computeSCEVAtScope()
9932 if (!AddRec) in computeSCEVAtScope()
9939 if (!AddRec->getLoop()->contains(L)) { in computeSCEVAtScope()
9942 const SCEV *BackedgeTakenCount = getBackedgeTakenCount(AddRec->getLoop()); in computeSCEVAtScope()
9944 return AddRec; in computeSCEVAtScope()
9947 return AddRec->evaluateAtIteration(BackedgeTakenCount, *this); in computeSCEVAtScope()
9950 return AddRec; in computeSCEVAtScope()
10166 GetQuadraticEquation(const SCEVAddRecExpr *AddRec) { in GetQuadraticEquation() argument
10167 assert(AddRec->getNumOperands() == 3 && "This is not a quadratic chrec!"); in GetQuadraticEquation()
10168 const SCEVConstant *LC = dyn_cast<SCEVConstant>(AddRec->getOperand(0)); in GetQuadraticEquation()
10169 const SCEVConstant *MC = dyn_cast<SCEVConstant>(AddRec->getOperand(1)); in GetQuadraticEquation()
10170 const SCEVConstant *NC = dyn_cast<SCEVConstant>(AddRec->getOperand(2)); in GetQuadraticEquation()
10172 << *AddRec << '\n'); in GetQuadraticEquation()
10268 SolveQuadraticAddRecExact(const SCEVAddRecExpr *AddRec, ScalarEvolution &SE) { in SolveQuadraticAddRecExact() argument
10271 auto T = GetQuadraticEquation(AddRec); in SolveQuadraticAddRecExact()
10283 ConstantInt *V = EvaluateConstantChrecAtConstant(AddRec, CX, SE); in SolveQuadraticAddRecExact()
10301 SolveQuadraticAddRecRange(const SCEVAddRecExpr *AddRec, in SolveQuadraticAddRecRange() argument
10303 assert(AddRec->getOperand(0)->isZero() && in SolveQuadraticAddRecRange()
10306 << Range << ", addrec " << *AddRec << '\n'); in SolveQuadraticAddRecRange()
10309 assert(Range.contains(APInt(SE.getTypeSizeInBits(AddRec->getType()), 0)) && in SolveQuadraticAddRecRange()
10314 auto T = GetQuadraticEquation(AddRec); in SolveQuadraticAddRecRange()
10347 ConstantInt *V0 = EvaluateConstantChrecAtConstant(AddRec, C0, SE); in SolveQuadraticAddRecRange()
10352 ConstantInt *V1 = EvaluateConstantChrecAtConstant(AddRec, C1, SE); in SolveQuadraticAddRecRange()
10447 const SCEVAddRecExpr *AddRec = in howFarToZero() local
10450 if (!AddRec && AllowPredicates) in howFarToZero()
10454 AddRec = convertSCEVToAddRecWithPredicates(V, L, Predicates); in howFarToZero()
10456 if (!AddRec || AddRec->getLoop() != L) in howFarToZero()
10461 if (AddRec->isQuadratic() && AddRec->getType()->isIntegerTy()) { in howFarToZero()
10465 if (auto S = SolveQuadraticAddRecExact(AddRec, *this)) { in howFarToZero()
10473 if (!AddRec->isAffine()) in howFarToZero()
10488 const SCEV *Start = getSCEVAtScope(AddRec->getStart(), L->getParentLoop()); in howFarToZero()
10489 const SCEV *Step = getSCEVAtScope(AddRec->getOperand(1), L->getParentLoop()); in howFarToZero()
10542 if (ControlsOnlyExit && AddRec->hasNoSelfWrap() && in howFarToZero()
10543 loopHasNoAbnormalExits(AddRec->getLoop())) { in howFarToZero()
14730 auto *AddRec = dyn_cast<SCEVAddRecExpr>(S); in convertSCEVToAddRecWithPredicates() local
14732 if (!AddRec) in convertSCEVToAddRecWithPredicates()
14740 return AddRec; in convertSCEVToAddRecWithPredicates()