• Home
  • Raw
  • Download

Lines Matching defs:AddRec

1132   if (const SCEVAddRecExpr *AddRec = dyn_cast<SCEVAddRecExpr>(Op)) {
1134 for (const SCEV *Op : AddRec->operands())
1136 return getAddRecExpr(Operands, AddRec->getLoop(), SCEV::FlagAnyWrap);
1236 // allows normalizing a sign/zero extended AddRec as such: {sext/zext(Step +
1313 // Get the normalized zero or sign extended expression for this AddRec's Start.
1498 // Cache knowledge of AR NUW, which is propagated to this AddRec.
1512 // Cache knowledge of AR NW, which is propagated to this AddRec.
1545 // AddRec.
1560 // AddRec. Negative step causes unsigned wrap, but it
1725 // Cache knowledge of AR NSW, which is propagated to this AddRec.
1780 // Cache knowledge of AR NSW, then propagate NSW to the wide AddRec.
2288 const SCEVAddRecExpr *AddRec = cast<SCEVAddRecExpr>(Ops[Idx]);
2289 const Loop *AddRecLoop = AddRec->getLoop();
2300 LIOps.push_back(AddRec->getStart());
2302 SmallVector<const SCEV *, 4> AddRecOps(AddRec->op_begin(),
2303 AddRec->op_end());
2312 Flags = AddRec->getNoWrapFlags(setFlags(Flags, SCEV::FlagNW));
2318 // Otherwise, add the folded AddRec by the non-invariant parts.
2320 if (Ops[i] == AddRec) {
2328 // there are multiple AddRec's with the same loop induction variable being
2335 SmallVector<const SCEV *, 4> AddRecOps(AddRec->op_begin(),
2336 AddRec->op_end());
2497 } else if (const auto *AddRec = dyn_cast<SCEVAddRecExpr>(Ops[1])) {
2500 for (const SCEV *AddRecOp : AddRec->operands())
2503 return getAddRecExpr(Operands, AddRec->getLoop(),
2504 AddRec->getNoWrapFlags(SCEV::FlagNW));
2546 const SCEVAddRecExpr *AddRec = cast<SCEVAddRecExpr>(Ops[Idx]);
2547 const Loop *AddRecLoop = AddRec->getLoop();
2559 NewOps.reserve(AddRec->getNumOperands());
2561 for (unsigned i = 0, e = AddRec->getNumOperands(); i != e; ++i)
2562 NewOps.push_back(getMulExpr(Scale, AddRec->getOperand(i)));
2569 Flags = AddRec->getNoWrapFlags(clearFlags(Flags, SCEV::FlagNW));
2575 // Otherwise, multiply the folded AddRec by the non-invariant parts.
2577 if (Ops[i] == AddRec) {
2585 // there are multiple AddRec's with the same loop induction variable being
2608 Type *Ty = AddRec->getType();
2611 for (int x = 0, xe = AddRec->getNumOperands() +
2616 for (int z = std::max(y-x, y-(int)AddRec->getNumOperands()+1),
2626 const SCEV *Term1 = AddRec->getOperand(y-z);
2634 const SCEV *NewAddRec = getAddRecExpr(AddRecOps, AddRec->getLoop(),
2640 AddRec = dyn_cast<SCEVAddRecExpr>(NewAddRec);
2641 if (!AddRec)
4514 if (const SCEVAddRecExpr *AddRec = dyn_cast<SCEVAddRecExpr>(S)) {
4517 if (AddRec->hasNoUnsignedWrap())
4518 if (const SCEVConstant *C = dyn_cast<SCEVConstant>(AddRec->getStart()))
4525 if (AddRec->hasNoSignedWrap()) {
4528 for (unsigned i = 0, e = AddRec->getNumOperands(); i != e; ++i) {
4529 if (!isKnownNonNegative(AddRec->getOperand(i))) AllNonNeg = false;
4530 if (!isKnownNonPositive(AddRec->getOperand(i))) AllNonPos = false;
4543 if (AddRec->isAffine()) {
4544 const SCEV *MaxBECount = getMaxBackedgeTakenCount(AddRec->getLoop());
4548 AddRec->getStart(), AddRec->getStepRecurrence(*this), MaxBECount,
4555 AddRec->getStart(), AddRec->getStepRecurrence(*this), MaxBECount,
4563 return setRange(AddRec, SignHint, ConservativeResult);
4826 if (auto *AddRec = dyn_cast<SCEVAddRecExpr>(Op)) {
4832 if (!isLoopInvariant(OtherOp, AddRec->getLoop())) {
4839 isGuaranteedToExecuteForEveryIteration(I, AddRec->getLoop()))
5975 if (const SCEVAddRecExpr *AddRec = dyn_cast<SCEVAddRecExpr>(LHS))
5976 if (AddRec->getLoop() == L) {
5981 const SCEV *Ret = AddRec->getNumIterationsInRange(CompRange, *this);
6055 EvaluateConstantChrecAtConstant(const SCEVAddRecExpr *AddRec, ConstantInt *C,
6058 const SCEV *Val = AddRec->evaluateAtIteration(InVal, SE);
6112 // particular, only affine AddRec's like {C1,+,C2}.
6849 if (const SCEVAddRecExpr *AddRec = dyn_cast<SCEVAddRecExpr>(V)) {
6853 for (unsigned i = 0, e = AddRec->getNumOperands(); i != e; ++i) {
6854 const SCEV *OpAtScope = getSCEVAtScope(AddRec->getOperand(i), L);
6855 if (OpAtScope == AddRec->getOperand(i))
6860 SmallVector<const SCEV *, 8> NewOps(AddRec->op_begin(),
6861 AddRec->op_begin()+i);
6864 NewOps.push_back(getSCEVAtScope(AddRec->getOperand(i), L));
6867 getAddRecExpr(NewOps, AddRec->getLoop(),
6868 AddRec->getNoWrapFlags(SCEV::FlagNW));
6869 AddRec = dyn_cast<SCEVAddRecExpr>(FoldedRec);
6873 if (!AddRec)
6880 if (!AddRec->getLoop()->contains(L)) {
6881 // To evaluate this recurrence, we need to know how many times the AddRec
6883 const SCEV *BackedgeTakenCount = getBackedgeTakenCount(AddRec->getLoop());
6884 if (BackedgeTakenCount == getCouldNotCompute()) return AddRec;
6886 // Then, evaluate the AddRec.
6887 return AddRec->evaluateAtIteration(BackedgeTakenCount, *this);
6890 return AddRec;
6973 SolveQuadraticEquation(const SCEVAddRecExpr *AddRec, ScalarEvolution &SE) {
6974 assert(AddRec->getNumOperands() == 3 && "This is not a quadratic chrec!");
6975 const SCEVConstant *LC = dyn_cast<SCEVConstant>(AddRec->getOperand(0));
6976 const SCEVConstant *MC = dyn_cast<SCEVConstant>(AddRec->getOperand(1));
6977 const SCEVConstant *NC = dyn_cast<SCEVConstant>(AddRec->getOperand(2));
7051 const SCEVAddRecExpr *AddRec = dyn_cast<SCEVAddRecExpr>(V);
7052 if (!AddRec && AllowPredicates)
7053 // Try to make this an AddRec using runtime tests, in the first X
7056 AddRec = convertSCEVToAddRecWithPredicates(V, L, P);
7058 if (!AddRec || AddRec->getLoop() != L)
7061 // If this is a quadratic (3-term) AddRec {L,+,M,+,N}, find the roots of
7063 if (AddRec->isQuadratic() && AddRec->getType()->isIntegerTy()) {
7064 if (auto Roots = SolveQuadraticEquation(AddRec, *this)) {
7076 const SCEV *Val = AddRec->evaluateAtIteration(R1, *this);
7085 if (!AddRec->isAffine())
7100 const SCEV *Start = getSCEVAtScope(AddRec->getStart(), L->getParentLoop());
7101 const SCEV *Step = getSCEVAtScope(AddRec->getOperand(1), L->getParentLoop());
7105 // TODO: Handle a nonconstant Step given AddRec<NUW>. If the
7106 // AddRec is NUW, then (in an unsigned sense) it cannot be counting up to wrap
7199 if (ControlsExit && AddRec->hasNoSelfWrap() &&
7200 loopHasNoAbnormalExits(AddRec->getLoop())) {
8648 // Try to make this an AddRec using runtime tests, in the first X
8723 // Try to make this an AddRec using runtime tests, in the first X
8852 // If this is a quadratic (3-term) AddRec {L,+,M,+,N}, find the roots of the
9005 // that contains the AddRec {0, +, 1}_loop. %p * %q are likely to be array size
9052 /// 1) The strides of AddRec expressions.
9053 /// 2) Unknowns that are multiplied with AddRec expressions.
9349 /// the delinearization input is the following AddRec SCEV:
9351 /// AddRec: {{{%A,+,(8 * %m * %o)}<%for.i>,+,(8 * %o)}<%for.j>,+,8}<%for.k>
10190 auto *AddRec = dyn_cast<SCEVAddRecExpr>(S);
10192 if (!AddRec)
10198 return AddRec;