Lines Matching refs:SCEV
136 void SCEV::dump() const { in dump()
142 void SCEV::print(raw_ostream &OS) const { in print()
149 const SCEV *Op = Trunc->getOperand(); in print()
156 const SCEV *Op = ZExt->getOperand(); in print()
163 const SCEV *Op = SExt->getOperand(); in print()
252 Type *SCEV::getType() const { in getType()
277 bool SCEV::isZero() const { in isZero()
283 bool SCEV::isOne() const { in isOne()
289 bool SCEV::isAllOnesValue() const { in isAllOnesValue()
297 bool SCEV::isNonConstantNegative() const { in isNonConstantNegative()
310 SCEV(FoldingSetNodeIDRef(), scCouldNotCompute) {} in SCEVCouldNotCompute()
312 bool SCEVCouldNotCompute::classof(const SCEV *S) { in classof()
316 const SCEV *ScalarEvolution::getConstant(ConstantInt *V) { in getConstant()
321 if (const SCEV *S = UniqueSCEVs.FindNodeOrInsertPos(ID, IP)) return S; in getConstant()
322 SCEV *S = new (SCEVAllocator) SCEVConstant(ID.Intern(SCEVAllocator), V); in getConstant()
327 const SCEV *ScalarEvolution::getConstant(const APInt &Val) { in getConstant()
331 const SCEV *
338 unsigned SCEVTy, const SCEV *op, Type *ty) in SCEVCastExpr()
339 : SCEV(ID, SCEVTy), Op(op), Ty(ty) {} in SCEVCastExpr()
342 const SCEV *op, Type *ty) in SCEVTruncateExpr()
350 const SCEV *op, Type *ty) in SCEVZeroExtendExpr()
358 const SCEV *op, Type *ty) in SCEVSignExtendExpr()
467 bool operator()(const SCEV *LHS, const SCEV *RHS) const { in operator ()()
474 int compare(const SCEV *LHS, const SCEV *RHS) const { in compare()
642 static void GroupByComplexity(SmallVectorImpl<const SCEV *> &Ops, in GroupByComplexity()
648 const SCEV *&LHS = Ops[0], *&RHS = Ops[1]; in GroupByComplexity()
662 const SCEV *S = Ops[i]; in GroupByComplexity()
683 bool follow(const SCEV *S) { in follow()
695 static inline int sizeOfSCEV(const SCEV *S) { in sizeOfSCEV()
708 static void divide(ScalarEvolution &SE, const SCEV *Numerator, in divide()
709 const SCEV *Denominator, const SCEV **Quotient, in divide()
710 const SCEV **Remainder) { in divide()
731 const SCEV *Q, *R; in divide()
733 for (const SCEV *Op : T->operands()) { in divide()
787 const SCEV *StartQ, *StartR, *StepQ, *StepR; in visitAddRecExpr()
798 SmallVector<const SCEV *, 2> Qs, Rs; in visitAddExpr()
801 for (const SCEV *Op : Numerator->operands()) { in visitAddExpr()
802 const SCEV *Q, *R; in visitAddExpr()
827 SmallVector<const SCEV *, 2> Qs; in visitMulExpr()
831 for (const SCEV *Op : Numerator->operands()) { in visitMulExpr()
845 const SCEV *Q, *R; in visitMulExpr()
894 const SCEV *Q, *R; in visitMulExpr()
895 const SCEV *Diff = SE.getMinusSCEV(Numerator, Remainder); in visitMulExpr()
909 SCEVDivision(ScalarEvolution &S, const SCEV *Numerator, in SCEVDivision()
910 const SCEV *Denominator) in SCEVDivision()
922 const SCEV *Denominator, *Quotient, *Remainder, *Zero, *One;
933 static const SCEV *BinomialCoefficient(const SCEV *It, unsigned K, in BinomialCoefficient()
1027 const SCEV *Dividend = SE.getTruncateOrZeroExtend(It, CalculationTy); in BinomialCoefficient()
1029 const SCEV *S = SE.getMinusSCEV(It, SE.getConstant(It->getType(), i)); in BinomialCoefficient()
1035 const SCEV *DivResult = SE.getUDivExpr(Dividend, SE.getConstant(DivFactor)); in BinomialCoefficient()
1052 const SCEV *SCEVAddRecExpr::evaluateAtIteration(const SCEV *It, in evaluateAtIteration()
1054 const SCEV *Result = getStart(); in evaluateAtIteration()
1059 const SCEV *Coeff = BinomialCoefficient(It, i, SE, getType()); in evaluateAtIteration()
1072 const SCEV *ScalarEvolution::getTruncateExpr(const SCEV *Op, in getTruncateExpr()
1085 if (const SCEV *S = UniqueSCEVs.FindNodeOrInsertPos(ID, IP)) return S; in getTruncateExpr()
1107 SmallVector<const SCEV *, 4> Operands; in getTruncateExpr()
1110 const SCEV *S = getTruncateExpr(SA->getOperand(i), Ty); in getTruncateExpr()
1123 SmallVector<const SCEV *, 4> Operands; in getTruncateExpr()
1126 const SCEV *S = getTruncateExpr(SM->getOperand(i), Ty); in getTruncateExpr()
1138 SmallVector<const SCEV *, 4> Operands; in getTruncateExpr()
1141 return getAddRecExpr(Operands, AddRec->getLoop(), SCEV::FlagAnyWrap); in getTruncateExpr()
1147 SCEV *S = new (SCEVAllocator) SCEVTruncateExpr(ID.Intern(SCEVAllocator), in getTruncateExpr()
1156 static const SCEV *getSignedOverflowLimitForStep(const SCEV *Step, in getSignedOverflowLimitForStep()
1176 static const SCEV *getUnsignedOverflowLimitForStep(const SCEV *Step, in getUnsignedOverflowLimitForStep()
1189 typedef const SCEV *(ScalarEvolution::*GetExtendExprTy)(const SCEV *, Type *);
1207 static const SCEV::NoWrapFlags WrapType = SCEV::FlagNSW;
1211 static const SCEV *getOverflowLimitForStep(const SCEV *Step, in getOverflowLimitForStep()
1223 static const SCEV::NoWrapFlags WrapType = SCEV::FlagNUW;
1227 static const SCEV *getOverflowLimitForStep(const SCEV *Step, in getOverflowLimitForStep()
1246 static const SCEV *getPreStartForExtend(const SCEVAddRecExpr *AR, Type *Ty, in getPreStartForExtend()
1252 const SCEV *Start = AR->getStart(); in getPreStartForExtend()
1253 const SCEV *Step = AR->getStepRecurrence(*SE); in getPreStartForExtend()
1263 SmallVector<const SCEV *, 4> DiffOps; in getPreStartForExtend()
1264 for (const SCEV *Op : SA->operands()) in getPreStartForExtend()
1275 const SCEV *PreStart = SE->getAddExpr(DiffOps, SA->getNoWrapFlags()); in getPreStartForExtend()
1277 SE->getAddRecExpr(PreStart, Step, L, SCEV::FlagAnyWrap)); in getPreStartForExtend()
1283 const SCEV *BECount = SE->getBackedgeTakenCount(L); in getPreStartForExtend()
1291 const SCEV *OperandExtendedStart = in getPreStartForExtend()
1306 const SCEV *OverflowLimit = in getPreStartForExtend()
1318 static const SCEV *getExtendAddRecStart(const SCEVAddRecExpr *AR, Type *Ty, in getExtendAddRecStart()
1322 const SCEV *PreStart = getPreStartForExtend<ExtendOpTy>(AR, Ty, SE); in getExtendAddRecStart()
1364 bool ScalarEvolution::proveNoWrapByVaryingStart(const SCEV *Start, in proveNoWrapByVaryingStart()
1365 const SCEV *Step, in proveNoWrapByVaryingStart()
1381 const SCEV *PreStart = getConstant(StartAI - Delta); in proveNoWrapByVaryingStart()
1397 const SCEV *DeltaS = getConstant(StartC->getType(), Delta); in proveNoWrapByVaryingStart()
1399 const SCEV *Limit = ExtendOpTraits<ExtendOpTy>::getOverflowLimitForStep( in proveNoWrapByVaryingStart()
1409 const SCEV *ScalarEvolution::getZeroExtendExpr(const SCEV *Op, in getZeroExtendExpr()
1433 if (const SCEV *S = UniqueSCEVs.FindNodeOrInsertPos(ID, IP)) return S; in getZeroExtendExpr()
1439 const SCEV *X = ST->getOperand(); in getZeroExtendExpr()
1454 const SCEV *Start = AR->getStart(); in getZeroExtendExpr()
1455 const SCEV *Step = AR->getStepRecurrence(*this); in getZeroExtendExpr()
1461 if (AR->getNoWrapFlags(SCEV::FlagNUW)) in getZeroExtendExpr()
1474 const SCEV *MaxBECount = getMaxBackedgeTakenCount(L); in getZeroExtendExpr()
1481 const SCEV *CastedMaxBECount = in getZeroExtendExpr()
1483 const SCEV *RecastedMaxBECount = in getZeroExtendExpr()
1488 const SCEV *ZMul = getMulExpr(CastedMaxBECount, Step); in getZeroExtendExpr()
1489 const SCEV *ZAdd = getZeroExtendExpr(getAddExpr(Start, ZMul), WideTy); in getZeroExtendExpr()
1490 const SCEV *WideStart = getZeroExtendExpr(Start, WideTy); in getZeroExtendExpr()
1491 const SCEV *WideMaxBECount = in getZeroExtendExpr()
1493 const SCEV *OperandExtendedAdd = in getZeroExtendExpr()
1499 const_cast<SCEVAddRecExpr *>(AR)->setNoWrapFlags(SCEV::FlagNUW); in getZeroExtendExpr()
1514 const_cast<SCEVAddRecExpr *>(AR)->setNoWrapFlags(SCEV::FlagNW); in getZeroExtendExpr()
1527 const SCEV *N = getConstant(APInt::getMinValue(BitWidth) - in getZeroExtendExpr()
1534 const_cast<SCEVAddRecExpr *>(AR)->setNoWrapFlags(SCEV::FlagNUW); in getZeroExtendExpr()
1541 const SCEV *N = getConstant(APInt::getMaxValue(BitWidth) - in getZeroExtendExpr()
1549 const_cast<SCEVAddRecExpr *>(AR)->setNoWrapFlags(SCEV::FlagNW); in getZeroExtendExpr()
1559 const_cast<SCEVAddRecExpr *>(AR)->setNoWrapFlags(SCEV::FlagNUW); in getZeroExtendExpr()
1568 if (const SCEV *S = UniqueSCEVs.FindNodeOrInsertPos(ID, IP)) return S; in getZeroExtendExpr()
1569 SCEV *S = new (SCEVAllocator) SCEVZeroExtendExpr(ID.Intern(SCEVAllocator), in getZeroExtendExpr()
1575 const SCEV *ScalarEvolution::getSignExtendExpr(const SCEV *Op, in getSignExtendExpr()
1603 if (const SCEV *S = UniqueSCEVs.FindNodeOrInsertPos(ID, IP)) return S; in getSignExtendExpr()
1613 const SCEV *X = ST->getOperand(); in getSignExtendExpr()
1645 const SCEV *Start = AR->getStart(); in getSignExtendExpr()
1646 const SCEV *Step = AR->getStepRecurrence(*this); in getSignExtendExpr()
1652 if (AR->getNoWrapFlags(SCEV::FlagNSW)) in getSignExtendExpr()
1655 getSignExtendExpr(Step, Ty), L, SCEV::FlagNSW); in getSignExtendExpr()
1665 const SCEV *MaxBECount = getMaxBackedgeTakenCount(L); in getSignExtendExpr()
1672 const SCEV *CastedMaxBECount = in getSignExtendExpr()
1674 const SCEV *RecastedMaxBECount = in getSignExtendExpr()
1679 const SCEV *SMul = getMulExpr(CastedMaxBECount, Step); in getSignExtendExpr()
1680 const SCEV *SAdd = getSignExtendExpr(getAddExpr(Start, SMul), WideTy); in getSignExtendExpr()
1681 const SCEV *WideStart = getSignExtendExpr(Start, WideTy); in getSignExtendExpr()
1682 const SCEV *WideMaxBECount = in getSignExtendExpr()
1684 const SCEV *OperandExtendedAdd = in getSignExtendExpr()
1690 const_cast<SCEVAddRecExpr *>(AR)->setNoWrapFlags(SCEV::FlagNSW); in getSignExtendExpr()
1711 const_cast<SCEVAddRecExpr *>(AR)->setNoWrapFlags(SCEV::FlagNW); in getSignExtendExpr()
1725 const SCEV *OverflowLimit = in getSignExtendExpr()
1733 const_cast<SCEVAddRecExpr *>(AR)->setNoWrapFlags(SCEV::FlagNSW); in getSignExtendExpr()
1750 const SCEV *NewAR = getAddRecExpr(getConstant(AR->getType(), 0), Step, in getSignExtendExpr()
1757 const_cast<SCEVAddRecExpr *>(AR)->setNoWrapFlags(SCEV::FlagNSW); in getSignExtendExpr()
1766 if (const SCEV *S = UniqueSCEVs.FindNodeOrInsertPos(ID, IP)) return S; in getSignExtendExpr()
1767 SCEV *S = new (SCEVAllocator) SCEVSignExtendExpr(ID.Intern(SCEVAllocator), in getSignExtendExpr()
1776 const SCEV *ScalarEvolution::getAnyExtendExpr(const SCEV *Op, in getAnyExtendExpr()
1791 const SCEV *NewOp = T->getOperand(); in getAnyExtendExpr()
1798 const SCEV *ZExt = getZeroExtendExpr(Op, Ty); in getAnyExtendExpr()
1803 const SCEV *SExt = getSignExtendExpr(Op, Ty); in getAnyExtendExpr()
1809 SmallVector<const SCEV *, 4> Ops; in getAnyExtendExpr()
1810 for (const SCEV *Op : AR->operands()) in getAnyExtendExpr()
1812 return getAddRecExpr(Ops, AR->getLoop(), SCEV::FlagNW); in getAnyExtendExpr()
1849 CollectAddOperandsWithScales(DenseMap<const SCEV *, APInt> &M, in CollectAddOperandsWithScales() argument
1850 SmallVectorImpl<const SCEV *> &NewOps, in CollectAddOperandsWithScales()
1852 const SCEV *const *Ops, size_t NumOperands, in CollectAddOperandsWithScales()
1884 SmallVector<const SCEV *, 4> MulOps(Mul->op_begin()+1, Mul->op_end()); in CollectAddOperandsWithScales()
1885 const SCEV *Key = SE.getMulExpr(MulOps); in CollectAddOperandsWithScales()
1886 std::pair<DenseMap<const SCEV *, APInt>::iterator, bool> Pair = in CollectAddOperandsWithScales()
1899 std::pair<DenseMap<const SCEV *, APInt>::iterator, bool> Pair = in CollectAddOperandsWithScales()
1926 static SCEV::NoWrapFlags
1928 const SmallVectorImpl<const SCEV *> &Ops, in StrengthenNoWrapFlags()
1929 SCEV::NoWrapFlags OldFlags) { in StrengthenNoWrapFlags()
1937 int SignOrUnsignMask = SCEV::FlagNUW | SCEV::FlagNSW; in StrengthenNoWrapFlags()
1938 SCEV::NoWrapFlags SignOrUnsignWrap = in StrengthenNoWrapFlags()
1945 if (SignOrUnsignWrap == SCEV::FlagNSW && in StrengthenNoWrapFlags()
1948 (SCEV::NoWrapFlags)SignOrUnsignMask); in StrengthenNoWrapFlags()
1955 const SCEV *ScalarEvolution::getAddExpr(SmallVectorImpl<const SCEV *> &Ops, in getAddExpr()
1956 SCEV::NoWrapFlags Flags) { in getAddExpr()
1957 assert(!(Flags & ~(SCEV::FlagNUW | SCEV::FlagNSW)) && in getAddExpr()
2008 const SCEV *Scale = getConstant(Ty, Count); in getAddExpr()
2009 const SCEV *Mul = getMulExpr(Scale, Ops[i]); in getAddExpr()
2028 SmallVector<const SCEV *, 8> LargeOps; in getAddExpr()
2042 SmallVector<const SCEV *, 8> LargeMulOps; in getAddExpr()
2068 const SCEV *Fold = getAddExpr(LargeOps, Flags); in getAddExpr()
2105 DenseMap<const SCEV *, APInt> M; in getAddExpr()
2106 SmallVector<const SCEV *, 8> NewOps; in getAddExpr()
2114 std::map<APInt, SmallVector<const SCEV *, 4>, APIntCompare> MulOpLists; in getAddExpr()
2115 for (SmallVectorImpl<const SCEV *>::const_iterator I = NewOps.begin(), in getAddExpr()
2122 for (std::map<APInt, SmallVector<const SCEV *, 4>, APIntCompare>::iterator in getAddExpr()
2141 const SCEV *MulOpSCEV = Mul->getOperand(MulOp); in getAddExpr()
2147 const SCEV *InnerMul = Mul->getOperand(MulOp == 0); in getAddExpr()
2151 SmallVector<const SCEV *, 4> MulOps(Mul->op_begin(), in getAddExpr()
2156 const SCEV *One = getConstant(Ty, 1); in getAddExpr()
2157 const SCEV *AddOne = getAddExpr(One, InnerMul); in getAddExpr()
2158 const SCEV *OuterMul = getMulExpr(AddOne, MulOpSCEV); in getAddExpr()
2182 const SCEV *InnerMul1 = Mul->getOperand(MulOp == 0); in getAddExpr()
2184 SmallVector<const SCEV *, 4> MulOps(Mul->op_begin(), in getAddExpr()
2189 const SCEV *InnerMul2 = OtherMul->getOperand(OMulOp == 0); in getAddExpr()
2191 SmallVector<const SCEV *, 4> MulOps(OtherMul->op_begin(), in getAddExpr()
2196 const SCEV *InnerMulSum = getAddExpr(InnerMul1,InnerMul2); in getAddExpr()
2197 const SCEV *OuterMul = getMulExpr(MulOpSCEV, InnerMulSum); in getAddExpr()
2218 SmallVector<const SCEV *, 8> LIOps; in getAddExpr()
2233 SmallVector<const SCEV *, 4> AddRecOps(AddRec->op_begin(), in getAddExpr()
2240 Flags = AddRec->getNoWrapFlags(setFlags(Flags, SCEV::FlagNW)); in getAddExpr()
2241 const SCEV *NewRec = getAddRecExpr(AddRecOps, AddRecLoop, Flags); in getAddExpr()
2263 SmallVector<const SCEV *, 4> AddRecOps(AddRec->op_begin(), in getAddExpr()
2283 Ops[Idx] = getAddRecExpr(AddRecOps, AddRecLoop, SCEV::FlagAnyWrap); in getAddExpr()
2301 const SCEV **O = SCEVAllocator.Allocate<const SCEV *>(Ops.size()); in getAddExpr()
2345 static bool containsConstantSomewhere(const SCEV *StartExpr) { in containsConstantSomewhere()
2346 SmallVector<const SCEV *, 4> Ops; in containsConstantSomewhere()
2349 const SCEV *CurrentExpr = Ops.pop_back_val(); in containsConstantSomewhere()
2363 const SCEV *ScalarEvolution::getMulExpr(SmallVectorImpl<const SCEV *> &Ops, in getMulExpr()
2364 SCEV::NoWrapFlags Flags) { in getMulExpr()
2365 assert(Flags == maskFlags(Flags, SCEV::FlagNUW | SCEV::FlagNSW) && in getMulExpr()
2419 SmallVector<const SCEV *, 4> NewOps; in getMulExpr()
2423 const SCEV *Mul = getMulExpr(Ops[0], *I); in getMulExpr()
2433 SmallVector<const SCEV *, 4> Operands; in getMulExpr()
2439 AddRec->getNoWrapFlags(SCEV::FlagNW)); in getMulExpr()
2480 SmallVector<const SCEV *, 8> LIOps; in getMulExpr()
2493 SmallVector<const SCEV *, 4> NewOps; in getMulExpr()
2495 const SCEV *Scale = getMulExpr(LIOps); in getMulExpr()
2504 Flags = AddRec->getNoWrapFlags(clearFlags(Flags, SCEV::FlagNW)); in getMulExpr()
2505 const SCEV *NewRec = getAddRecExpr(NewOps, AddRecLoop, Flags); in getMulExpr()
2545 SmallVector<const SCEV*, 7> AddRecOps; in getMulExpr()
2548 const SCEV *Term = getConstant(Ty, 0); in getMulExpr()
2560 const SCEV *CoeffTerm = getConstant(Ty, Coeff); in getMulExpr()
2561 const SCEV *Term1 = AddRec->getOperand(y-z); in getMulExpr()
2562 const SCEV *Term2 = OtherAddRec->getOperand(z); in getMulExpr()
2569 const SCEV *NewAddRec = getAddRecExpr(AddRecOps, AddRec->getLoop(), in getMulExpr()
2570 SCEV::FlagAnyWrap); in getMulExpr()
2597 const SCEV **O = SCEVAllocator.Allocate<const SCEV *>(Ops.size()); in getMulExpr()
2609 const SCEV *ScalarEvolution::getUDivExpr(const SCEV *LHS, in getUDivExpr()
2610 const SCEV *RHS) { in getUDivExpr()
2644 AR->getLoop(), SCEV::FlagAnyWrap)) { in getUDivExpr()
2645 SmallVector<const SCEV *, 4> Operands; in getUDivExpr()
2649 SCEV::FlagNW); in getUDivExpr()
2659 AR->getLoop(), SCEV::FlagAnyWrap)) { in getUDivExpr()
2664 AR->getLoop(), SCEV::FlagNW); in getUDivExpr()
2669 SmallVector<const SCEV *, 4> Operands; in getUDivExpr()
2675 const SCEV *Op = M->getOperand(i); in getUDivExpr()
2676 const SCEV *Div = getUDivExpr(Op, RHSC); in getUDivExpr()
2678 Operands = SmallVector<const SCEV *, 4>(M->op_begin(), in getUDivExpr()
2687 SmallVector<const SCEV *, 4> Operands; in getUDivExpr()
2693 const SCEV *Op = getUDivExpr(A->getOperand(i), RHS); in getUDivExpr()
2719 if (const SCEV *S = UniqueSCEVs.FindNodeOrInsertPos(ID, IP)) return S; in getUDivExpr()
2720 SCEV *S = new (SCEVAllocator) SCEVUDivExpr(ID.Intern(SCEVAllocator), in getUDivExpr()
2744 const SCEV *ScalarEvolution::getUDivExactExpr(const SCEV *LHS, in getUDivExactExpr()
2745 const SCEV *RHS) { in getUDivExactExpr()
2760 SmallVector<const SCEV *, 2> Operands; in getUDivExactExpr()
2774 SmallVector<const SCEV *, 2> Operands; in getUDivExactExpr()
2788 SmallVector<const SCEV *, 2> Operands; in getUDivExactExpr()
2800 const SCEV *ScalarEvolution::getAddRecExpr(const SCEV *Start, const SCEV *Step, in getAddRecExpr()
2802 SCEV::NoWrapFlags Flags) { in getAddRecExpr()
2803 SmallVector<const SCEV *, 4> Operands; in getAddRecExpr()
2808 return getAddRecExpr(Operands, L, maskFlags(Flags, SCEV::FlagNW)); in getAddRecExpr()
2817 const SCEV *
2818 ScalarEvolution::getAddRecExpr(SmallVectorImpl<const SCEV *> &Operands, in getAddRecExpr()
2819 const Loop *L, SCEV::NoWrapFlags Flags) { in getAddRecExpr()
2833 return getAddRecExpr(Operands, L, SCEV::FlagAnyWrap); // {X,+,0} --> X in getAddRecExpr()
2851 SmallVector<const SCEV *, 4> NestedOperands(NestedAR->op_begin(), in getAddRecExpr()
2868 SCEV::NoWrapFlags OuterFlags = in getAddRecExpr()
2869 maskFlags(Flags, SCEV::FlagNW | NestedAR->getNoWrapFlags()); in getAddRecExpr()
2883 SCEV::NoWrapFlags InnerFlags = in getAddRecExpr()
2884 maskFlags(NestedAR->getNoWrapFlags(), SCEV::FlagNW | Flags); in getAddRecExpr()
2904 const SCEV **O = SCEVAllocator.Allocate<const SCEV *>(Operands.size()); in getAddRecExpr()
2914 const SCEV *ScalarEvolution::getSMaxExpr(const SCEV *LHS, in getSMaxExpr()
2915 const SCEV *RHS) { in getSMaxExpr()
2916 SmallVector<const SCEV *, 2> Ops; in getSMaxExpr()
2922 const SCEV *
2923 ScalarEvolution::getSMaxExpr(SmallVectorImpl<const SCEV *> &Ops) { in getSMaxExpr()
3009 if (const SCEV *S = UniqueSCEVs.FindNodeOrInsertPos(ID, IP)) return S; in getSMaxExpr()
3010 const SCEV **O = SCEVAllocator.Allocate<const SCEV *>(Ops.size()); in getSMaxExpr()
3012 SCEV *S = new (SCEVAllocator) SCEVSMaxExpr(ID.Intern(SCEVAllocator), in getSMaxExpr()
3018 const SCEV *ScalarEvolution::getUMaxExpr(const SCEV *LHS, in getUMaxExpr()
3019 const SCEV *RHS) { in getUMaxExpr()
3020 SmallVector<const SCEV *, 2> Ops; in getUMaxExpr()
3026 const SCEV *
3027 ScalarEvolution::getUMaxExpr(SmallVectorImpl<const SCEV *> &Ops) { in getUMaxExpr()
3113 if (const SCEV *S = UniqueSCEVs.FindNodeOrInsertPos(ID, IP)) return S; in getUMaxExpr()
3114 const SCEV **O = SCEVAllocator.Allocate<const SCEV *>(Ops.size()); in getUMaxExpr()
3116 SCEV *S = new (SCEVAllocator) SCEVUMaxExpr(ID.Intern(SCEVAllocator), in getUMaxExpr()
3122 const SCEV *ScalarEvolution::getSMinExpr(const SCEV *LHS, in getSMinExpr()
3123 const SCEV *RHS) { in getSMinExpr()
3128 const SCEV *ScalarEvolution::getUMinExpr(const SCEV *LHS, in getUMinExpr()
3129 const SCEV *RHS) { in getUMinExpr()
3134 const SCEV *ScalarEvolution::getSizeOfExpr(Type *IntTy, Type *AllocTy) { in getSizeOfExpr()
3142 const SCEV *ScalarEvolution::getOffsetOfExpr(Type *IntTy, in getOffsetOfExpr()
3154 const SCEV *ScalarEvolution::getUnknown(Value *V) { in getUnknown()
3164 if (SCEV *S = UniqueSCEVs.FindNodeOrInsertPos(ID, IP)) { in getUnknown()
3169 SCEV *S = new (SCEVAllocator) SCEVUnknown(ID.Intern(SCEVAllocator), V, this, in getUnknown()
3212 const SCEV *ScalarEvolution::getCouldNotCompute() { in getCouldNotCompute()
3224 bool follow(const SCEV *S) { in follow()
3240 bool ScalarEvolution::checkValidity(const SCEV *S) const { in checkValidity()
3250 const SCEV *ScalarEvolution::getSCEV(Value *V) { in getSCEV()
3255 const SCEV *S = I->second; in getSCEV()
3261 const SCEV *S = createSCEV(V); in getSCEV()
3273 const SCEV *ScalarEvolution::getNegativeSCEV(const SCEV *V) { in getNegativeSCEV()
3285 const SCEV *ScalarEvolution::getNotSCEV(const SCEV *V) { in getNotSCEV()
3292 const SCEV *AllOnes = in getNotSCEV()
3298 const SCEV *ScalarEvolution::getMinusSCEV(const SCEV *LHS, const SCEV *RHS, in getMinusSCEV()
3299 SCEV::NoWrapFlags Flags) { in getMinusSCEV()
3300 assert(!maskFlags(Flags, SCEV::FlagNUW) && "subtraction does not have NUW"); in getMinusSCEV()
3314 const SCEV *
3315 ScalarEvolution::getTruncateOrZeroExtend(const SCEV *V, Type *Ty) { in getTruncateOrZeroExtend()
3330 const SCEV *
3331 ScalarEvolution::getTruncateOrSignExtend(const SCEV *V, in getTruncateOrSignExtend()
3347 const SCEV *
3348 ScalarEvolution::getNoopOrZeroExtend(const SCEV *V, Type *Ty) { in getNoopOrZeroExtend()
3363 const SCEV *
3364 ScalarEvolution::getNoopOrSignExtend(const SCEV *V, Type *Ty) { in getNoopOrSignExtend()
3380 const SCEV *
3381 ScalarEvolution::getNoopOrAnyExtend(const SCEV *V, Type *Ty) { in getNoopOrAnyExtend()
3395 const SCEV *
3396 ScalarEvolution::getTruncateOrNoop(const SCEV *V, Type *Ty) { in getTruncateOrNoop()
3411 const SCEV *ScalarEvolution::getUMaxFromMismatchedTypes(const SCEV *LHS, in getUMaxFromMismatchedTypes()
3412 const SCEV *RHS) { in getUMaxFromMismatchedTypes()
3413 const SCEV *PromotedLHS = LHS; in getUMaxFromMismatchedTypes()
3414 const SCEV *PromotedRHS = RHS; in getUMaxFromMismatchedTypes()
3427 const SCEV *ScalarEvolution::getUMinFromMismatchedTypes(const SCEV *LHS, in getUMinFromMismatchedTypes()
3428 const SCEV *RHS) { in getUMinFromMismatchedTypes()
3429 const SCEV *PromotedLHS = LHS; in getUMinFromMismatchedTypes()
3430 const SCEV *PromotedRHS = RHS; in getUMinFromMismatchedTypes()
3444 const SCEV *ScalarEvolution::getPointerBase(const SCEV *V) { in getPointerBase()
3453 const SCEV *PtrOp = nullptr; in getPointerBase()
3485 ScalarEvolution::ForgetSymbolicName(Instruction *PN, const SCEV *SymName) { in ForgetSymbolicName()
3499 const SCEV *Old = It->second; in ForgetSymbolicName()
3528 const SCEV *ScalarEvolution::createNodeForPHI(PHINode *PN) { in createNodeForPHI()
3553 const SCEV *SymbolicName = getUnknown(PN); in createNodeForPHI()
3560 const SCEV *BEValue = getSCEV(BEValueV); in createNodeForPHI()
3580 SmallVector<const SCEV *, 8> Ops; in createNodeForPHI()
3584 const SCEV *Accum = getAddExpr(Ops); in createNodeForPHI()
3591 SCEV::NoWrapFlags Flags = SCEV::FlagAnyWrap; in createNodeForPHI()
3598 Flags = setFlags(Flags, SCEV::FlagNUW); in createNodeForPHI()
3600 Flags = setFlags(Flags, SCEV::FlagNSW); in createNodeForPHI()
3610 Flags = setFlags(Flags, SCEV::FlagNW); in createNodeForPHI()
3612 const SCEV *Ptr = getSCEV(GEP->getPointerOperand()); in createNodeForPHI()
3614 Flags = setFlags(Flags, SCEV::FlagNUW); in createNodeForPHI()
3622 const SCEV *StartVal = getSCEV(StartValueV); in createNodeForPHI()
3623 const SCEV *PHISCEV = getAddRecExpr(StartVal, Accum, L, Flags); in createNodeForPHI()
3647 const SCEV *StartVal = getSCEV(StartValueV); in createNodeForPHI()
3655 const SCEV *PHISCEV = in createNodeForPHI()
3657 SCEV::FlagAnyWrap); in createNodeForPHI()
3687 const SCEV *ScalarEvolution::createNodeForGEP(GEPOperator *GEP) { in createNodeForGEP()
3698 SCEV::NoWrapFlags Wrap = GEP->isInBounds() ? SCEV::FlagNSW : SCEV::FlagAnyWrap; in createNodeForGEP()
3700 const SCEV *TotalOffset = getConstant(IntPtrTy, 0); in createNodeForGEP()
3710 const SCEV *FieldOffset = getOffsetOfExpr(IntPtrTy, STy, FieldNo); in createNodeForGEP()
3716 const SCEV *ElementSize = getSizeOfExpr(IntPtrTy, *GTI); in createNodeForGEP()
3717 const SCEV *IndexS = getSCEV(Index); in createNodeForGEP()
3722 const SCEV *LocalOffset = getMulExpr(IndexS, ElementSize, Wrap); in createNodeForGEP()
3730 const SCEV *BaseS = getSCEV(Base); in createNodeForGEP()
3741 ScalarEvolution::GetMinTrailingZeros(const SCEV *S) { in GetMinTrailingZeros()
3849 ScalarEvolution::getRange(const SCEV *S, in getRange()
3851 DenseMap<const SCEV *, ConstantRange> &Cache = in getRange()
3856 DenseMap<const SCEV *, ConstantRange>::iterator I = Cache.find(S); in getRange()
3936 if (AddRec->getNoWrapFlags(SCEV::FlagNUW)) in getRange()
3945 if (AddRec->getNoWrapFlags(SCEV::FlagNSW)) { in getRange()
3965 const SCEV *MaxBECount = getMaxBackedgeTakenCount(AddRec->getLoop()); in getRange()
3978 const SCEV *Start = AddRec->getStart(); in getRange()
3979 const SCEV *Step = AddRec->getStepRecurrence(*this); in getRange()
4066 const SCEV *ScalarEvolution::createSCEV(Value *V) { in createSCEV()
4106 SmallVector<const SCEV *, 4> AddOps; in createSCEV()
4113 const SCEV *Op1 = getSCEV(U->getOperand(1)); in createSCEV()
4124 SmallVector<const SCEV *, 4> MulOps; in createSCEV()
4165 const SCEV *MulCount = getConstant( in createSCEV()
4186 const SCEV *LHS = getSCEV(U->getOperand(0)); in createSCEV()
4191 const SCEV *S = getAddExpr(LHS, getSCEV(CI)); in createSCEV()
4226 const SCEV *Z0 = Z->getOperand(); in createSCEV()
4353 const SCEV *LS = getNoopOrSignExtend(getSCEV(LHS), U->getType()); in createSCEV()
4354 const SCEV *RS = getNoopOrSignExtend(getSCEV(RHS), U->getType()); in createSCEV()
4355 const SCEV *LA = getSCEV(U->getOperand(1)); in createSCEV()
4356 const SCEV *RA = getSCEV(U->getOperand(2)); in createSCEV()
4357 const SCEV *LDiff = getMinusSCEV(LA, LS); in createSCEV()
4358 const SCEV *RDiff = getMinusSCEV(RA, RS); in createSCEV()
4377 const SCEV *LS = getNoopOrZeroExtend(getSCEV(LHS), U->getType()); in createSCEV()
4378 const SCEV *RS = getNoopOrZeroExtend(getSCEV(RHS), U->getType()); in createSCEV()
4379 const SCEV *LA = getSCEV(U->getOperand(1)); in createSCEV()
4380 const SCEV *RA = getSCEV(U->getOperand(2)); in createSCEV()
4381 const SCEV *LDiff = getMinusSCEV(LA, LS); in createSCEV()
4382 const SCEV *RDiff = getMinusSCEV(RA, RS); in createSCEV()
4396 const SCEV *One = getConstant(U->getType(), 1); in createSCEV()
4397 const SCEV *LS = getNoopOrZeroExtend(getSCEV(LHS), U->getType()); in createSCEV()
4398 const SCEV *LA = getSCEV(U->getOperand(1)); in createSCEV()
4399 const SCEV *RA = getSCEV(U->getOperand(2)); in createSCEV()
4400 const SCEV *LDiff = getMinusSCEV(LA, LS); in createSCEV()
4401 const SCEV *RDiff = getMinusSCEV(RA, One); in createSCEV()
4411 const SCEV *One = getConstant(U->getType(), 1); in createSCEV()
4412 const SCEV *LS = getNoopOrZeroExtend(getSCEV(LHS), U->getType()); in createSCEV()
4413 const SCEV *LA = getSCEV(U->getOperand(1)); in createSCEV()
4414 const SCEV *RA = getSCEV(U->getOperand(2)); in createSCEV()
4415 const SCEV *LDiff = getMinusSCEV(LA, One); in createSCEV()
4416 const SCEV *RDiff = getMinusSCEV(RA, LS); in createSCEV()
4503 const SCEV *ExitCount = getExitCount(L, ExitingBlock); in getSmallConstantTripMultiple()
4508 const SCEV *TCMul = getAddExpr(ExitCount, in getSmallConstantTripMultiple()
4534 const SCEV *ScalarEvolution::getExitCount(Loop *L, BasicBlock *ExitingBlock) { in getExitCount()
4549 const SCEV *ScalarEvolution::getBackedgeTakenCount(const Loop *L) { in getBackedgeTakenCount()
4556 const SCEV *ScalarEvolution::getMaxBackedgeTakenCount(const Loop *L) { in getMaxBackedgeTakenCount()
4619 const SCEV *Old = It->second; in getBackedgeTakenInfo()
4725 const SCEV *
4734 const SCEV *BECount = nullptr; in getExact()
4750 const SCEV *
4763 const SCEV *
4768 bool ScalarEvolution::BackedgeTakenInfo::hasOperand(const SCEV *S, in hasOperand()
4790 SmallVectorImpl< std::pair<BasicBlock *, const SCEV *> > &ExitCounts, in BackedgeTakenInfo()
4791 bool Complete, const SCEV *MaxCount) : Max(MaxCount) { in BackedgeTakenInfo()
4828 SmallVector<std::pair<BasicBlock *, const SCEV *>, 4> ExitCounts; in ComputeBackedgeTakenCount()
4831 const SCEV *MustExitMaxBECount = nullptr; in ComputeBackedgeTakenCount()
4832 const SCEV *MayExitMaxBECount = nullptr; in ComputeBackedgeTakenCount()
4875 const SCEV *MaxBECount = MustExitMaxBECount ? MustExitMaxBECount : in ComputeBackedgeTakenCount()
4985 const SCEV *BECount = getCouldNotCompute(); in ComputeExitLimitFromCond()
4986 const SCEV *MaxBECount = getCouldNotCompute(); in ComputeExitLimitFromCond()
5020 const SCEV *BECount = getCouldNotCompute(); in ComputeExitLimitFromCond()
5021 const SCEV *MaxBECount = getCouldNotCompute(); in ComputeExitLimitFromCond()
5098 const SCEV *LHS = getSCEV(ExitCond->getOperand(0)); in ComputeExitLimitFromICmp()
5099 const SCEV *RHS = getSCEV(ExitCond->getOperand(1)); in ComputeExitLimitFromICmp()
5125 const SCEV *Ret = AddRec->getNumIterationsInRange(CompRange, *this); in ComputeExitLimitFromICmp()
5183 const SCEV *LHS = getSCEVAtScope(Switch->getCondition(), L); in ComputeExitLimitFromSingleExitSwitch()
5184 const SCEV *RHS = getConstant(Switch->findCaseDest(ExitingBlock)); in ComputeExitLimitFromSingleExitSwitch()
5197 const SCEV *InVal = SE.getConstant(C); in EvaluateConstantChrecAtConstant()
5198 const SCEV *Val = AddRec->evaluateAtIteration(InVal, SE); in EvaluateConstantChrecAtConstant()
5249 const SCEV *Idx = getSCEV(VarIdx); in ComputeLoadConstantCompareExitLimit()
5527 const SCEV *ScalarEvolution::ComputeExitCountExhaustively(const Loop *L, in ComputeExitCountExhaustively()
5611 const SCEV *ScalarEvolution::getSCEVAtScope(const SCEV *V, const Loop *L) { in getSCEVAtScope()
5613 SmallVector<std::pair<const Loop *, const SCEV *>, 2> &Values = ValuesAtScopes[V]; in getSCEVAtScope()
5618 Values.push_back(std::make_pair(L, static_cast<const SCEV *>(nullptr))); in getSCEVAtScope()
5620 const SCEV *C = computeSCEVAtScope(V, L); in getSCEVAtScope()
5621 SmallVector<std::pair<const Loop *, const SCEV *>, 2> &Values2 = ValuesAtScopes[V]; in getSCEVAtScope()
5635 static Constant *BuildConstantFromSCEV(const SCEV *V) { in BuildConstantFromSCEV()
5730 const SCEV *ScalarEvolution::computeSCEVAtScope(const SCEV *V, const Loop *L) { in computeSCEVAtScope()
5745 const SCEV *BackedgeTakenCount = getBackedgeTakenCount(LI); in computeSCEVAtScope()
5778 const SCEV *OrigV = getSCEV(Op); in computeSCEVAtScope()
5779 const SCEV *OpV = getSCEVAtScope(OrigV, L); in computeSCEVAtScope()
5819 const SCEV *OpAtScope = getSCEVAtScope(Comm->getOperand(i), L); in computeSCEVAtScope()
5823 SmallVector<const SCEV *, 8> NewOps(Comm->op_begin(), in computeSCEVAtScope()
5847 const SCEV *LHS = getSCEVAtScope(Div->getLHS(), L); in computeSCEVAtScope()
5848 const SCEV *RHS = getSCEVAtScope(Div->getRHS(), L); in computeSCEVAtScope()
5861 const SCEV *OpAtScope = getSCEVAtScope(AddRec->getOperand(i), L); in computeSCEVAtScope()
5867 SmallVector<const SCEV *, 8> NewOps(AddRec->op_begin(), in computeSCEVAtScope()
5873 const SCEV *FoldedRec = in computeSCEVAtScope()
5875 AddRec->getNoWrapFlags(SCEV::FlagNW)); in computeSCEVAtScope()
5890 const SCEV *BackedgeTakenCount = getBackedgeTakenCount(AddRec->getLoop()); in computeSCEVAtScope()
5901 const SCEV *Op = getSCEVAtScope(Cast->getOperand(), L); in computeSCEVAtScope()
5908 const SCEV *Op = getSCEVAtScope(Cast->getOperand(), L); in computeSCEVAtScope()
5915 const SCEV *Op = getSCEVAtScope(Cast->getOperand(), L); in computeSCEVAtScope()
5926 const SCEV *ScalarEvolution::getSCEVAtScope(Value *V, const Loop *L) { in getSCEVAtScope()
5939 static const SCEV *SolveLinEquationWithOverflow(const APInt &A, const APInt &B, in SolveLinEquationWithOverflow()
5982 static std::pair<const SCEV *,const SCEV *>
5991 const SCEV *CNC = SE.getCouldNotCompute(); in SolveQuadraticEquation()
6020 const SCEV *CNC = SE.getCouldNotCompute(); in SolveQuadraticEquation()
6033 const SCEV *CNC = SE.getCouldNotCompute(); in SolveQuadraticEquation()
6057 ScalarEvolution::HowFarToZero(const SCEV *V, const Loop *L, bool ControlsExit) { in HowFarToZero()
6072 std::pair<const SCEV *,const SCEV *> Roots = in HowFarToZero()
6092 const SCEV *Val = AddRec->evaluateAtIteration(R1, *this); in HowFarToZero()
6116 const SCEV *Start = getSCEVAtScope(AddRec->getStart(), L->getParentLoop()); in HowFarToZero()
6117 const SCEV *Step = getSCEVAtScope(AddRec->getOperand(1), L->getParentLoop()); in HowFarToZero()
6135 const SCEV *Distance = CountDown ? Start : getNegativeSCEV(Start); in HowFarToZero()
6142 const SCEV *MaxBECount; in HowFarToZero()
6173 if (ControlsExit && AddRec->getNoWrapFlags(SCEV::FlagNW)) { in HowFarToZero()
6174 const SCEV *Exact = in HowFarToZero()
6191 ScalarEvolution::HowFarToNonZero(const SCEV *V, const Loop *L) { in HowFarToNonZero()
6237 static bool HasSameValue(const SCEV *A, const SCEV *B) { in HasSameValue()
6258 const SCEV *&LHS, const SCEV *&RHS, in SimplifyICmpOperands()
6459 SCEV::FlagNSW); in SimplifyICmpOperands()
6464 SCEV::FlagNSW); in SimplifyICmpOperands()
6472 SCEV::FlagNSW); in SimplifyICmpOperands()
6477 SCEV::FlagNSW); in SimplifyICmpOperands()
6485 SCEV::FlagNUW); in SimplifyICmpOperands()
6490 SCEV::FlagNUW); in SimplifyICmpOperands()
6498 SCEV::FlagNUW); in SimplifyICmpOperands()
6503 SCEV::FlagNUW); in SimplifyICmpOperands()
6534 bool ScalarEvolution::isKnownNegative(const SCEV *S) { in isKnownNegative()
6538 bool ScalarEvolution::isKnownPositive(const SCEV *S) { in isKnownPositive()
6542 bool ScalarEvolution::isKnownNonNegative(const SCEV *S) { in isKnownNonNegative()
6546 bool ScalarEvolution::isKnownNonPositive(const SCEV *S) { in isKnownNonPositive()
6550 bool ScalarEvolution::isKnownNonZero(const SCEV *S) { in isKnownNonZero()
6555 const SCEV *LHS, const SCEV *RHS) { in isKnownPredicate()
6592 const SCEV *LHS, const SCEV *RHS) { in isKnownPredicateWithRanges()
6651 const SCEV *Diff = getMinusSCEV(LHS, RHS); in isKnownPredicateWithRanges()
6670 const SCEV *LHS, const SCEV *RHS) { in isLoopBackedgeGuardedByCond()
6769 const SCEV *LHS, const SCEV *RHS) { in isLoopEntryGuardedByCond()
6832 const SCEV *LHS, const SCEV *RHS, in isImpliedCond()
6863 const SCEV *FoundLHS = getSCEV(ICI->getOperand(0)); in isImpliedCond()
6864 const SCEV *FoundRHS = getSCEV(ICI->getOperand(1)); in isImpliedCond()
6926 const SCEV *V = nullptr; in isImpliedCond()
6999 const SCEV *LHS, const SCEV *RHS, in isImpliedCondOperands()
7000 const SCEV *FoundLHS, in isImpliedCondOperands()
7001 const SCEV *FoundRHS) { in isImpliedCondOperands()
7015 static const SCEV *MatchNotExpr(const SCEV *Expr) { in MatchNotExpr()
7036 static bool IsMaxConsistingOf(const SCEV *MaybeMaxExpr, in IsMaxConsistingOf()
7037 const SCEV *Candidate) { in IsMaxConsistingOf()
7049 const SCEV *MaybeMinExpr, in IsMinConsistingOf()
7050 const SCEV *Candidate) { in IsMinConsistingOf()
7051 const SCEV *MaybeMaxExpr = MatchNotExpr(MaybeMinExpr); in IsMinConsistingOf()
7063 const SCEV *LHS, const SCEV *RHS) { in IsKnownPredicateViaMinOrMax()
7097 const SCEV *LHS, const SCEV *RHS, in isImpliedCondOperandsHelper()
7098 const SCEV *FoundLHS, in isImpliedCondOperandsHelper()
7099 const SCEV *FoundRHS) { in isImpliedCondOperandsHelper()
7101 [this](ICmpInst::Predicate Pred, const SCEV *LHS, const SCEV *RHS) { in isImpliedCondOperandsHelper()
7145 const SCEV *LHS, in isImpliedCondOperandsViaRanges()
7146 const SCEV *RHS, in isImpliedCondOperandsViaRanges()
7147 const SCEV *FoundLHS, in isImpliedCondOperandsViaRanges()
7148 const SCEV *FoundRHS) { in isImpliedCondOperandsViaRanges()
7186 bool ScalarEvolution::doesIVOverflowOnLT(const SCEV *RHS, const SCEV *Stride, in doesIVOverflowOnLT()
7191 const SCEV *One = getConstant(Stride->getType(), 1); in doesIVOverflowOnLT()
7215 bool ScalarEvolution::doesIVOverflowOnGT(const SCEV *RHS, const SCEV *Stride, in doesIVOverflowOnGT()
7220 const SCEV *One = getConstant(Stride->getType(), 1); in doesIVOverflowOnGT()
7243 const SCEV *ScalarEvolution::computeBECount(const SCEV *Delta, const SCEV *Step, in computeBECount()
7245 const SCEV *One = getConstant(Step->getType(), 1); in computeBECount()
7259 ScalarEvolution::HowManyLessThans(const SCEV *LHS, const SCEV *RHS, in HowManyLessThans()
7273 IV->getNoWrapFlags(IsSigned ? SCEV::FlagNSW : SCEV::FlagNUW); in HowManyLessThans()
7275 const SCEV *Stride = IV->getStepRecurrence(*this); in HowManyLessThans()
7290 const SCEV *Start = IV->getStart(); in HowManyLessThans()
7291 const SCEV *End = RHS; in HowManyLessThans()
7293 const SCEV *Diff = getMinusSCEV(RHS, Start); in HowManyLessThans()
7306 const SCEV *BECount = computeBECount(getMinusSCEV(End, Start), Stride, false); in HowManyLessThans()
7325 const SCEV *MaxBECount; in HowManyLessThans()
7339 ScalarEvolution::HowManyGreaterThans(const SCEV *LHS, const SCEV *RHS, in HowManyGreaterThans()
7353 IV->getNoWrapFlags(IsSigned ? SCEV::FlagNSW : SCEV::FlagNUW); in HowManyGreaterThans()
7355 const SCEV *Stride = getNegativeSCEV(IV->getStepRecurrence(*this)); in HowManyGreaterThans()
7371 const SCEV *Start = IV->getStart(); in HowManyGreaterThans()
7372 const SCEV *End = RHS; in HowManyGreaterThans()
7374 const SCEV *Diff = getMinusSCEV(RHS, Start); in HowManyGreaterThans()
7387 const SCEV *BECount = computeBECount(getMinusSCEV(Start, End), Stride, false); in HowManyGreaterThans()
7407 const SCEV *MaxBECount = getCouldNotCompute(); in HowManyGreaterThans()
7425 const SCEV *SCEVAddRecExpr::getNumIterationsInRange(ConstantRange Range, in getNumIterationsInRange()
7433 SmallVector<const SCEV *, 4> Operands(op_begin(), op_end()); in getNumIterationsInRange()
7435 const SCEV *Shifted = SE.getAddRecExpr(Operands, getLoop(), in getNumIterationsInRange()
7495 SmallVector<const SCEV *, 4> NewOps(op_begin(), op_end()); in getNumIterationsInRange()
7497 const SCEV *NewAddRec = SE.getAddRecExpr(NewOps, getLoop(), in getNumIterationsInRange()
7502 std::pair<const SCEV *,const SCEV *> Roots = in getNumIterationsInRange()
7551 bool follow(const SCEV *S) { in follow()
7572 containsUndefs(const SCEV *S) { in containsUndefs()
7584 SmallVectorImpl<const SCEV *> &Strides;
7586 SCEVCollectStrides(ScalarEvolution &SE, SmallVectorImpl<const SCEV *> &S) in SCEVCollectStrides()
7589 bool follow(const SCEV *S) { in follow()
7599 SmallVectorImpl<const SCEV *> &Terms;
7601 SCEVCollectTerms(SmallVectorImpl<const SCEV *> &T) in SCEVCollectTerms()
7604 bool follow(const SCEV *S) { in follow()
7622 ScalarEvolution &SE, SmallVectorImpl<const SCEV *> &Terms) const { in collectParametricTerms()
7623 SmallVector<const SCEV *, 4> Strides; in collectParametricTerms()
7629 for (const SCEV *S : Strides) in collectParametricTerms()
7633 for (const SCEV *S : Strides) { in collectParametricTerms()
7640 for (const SCEV *T : Terms) in collectParametricTerms()
7646 SmallVectorImpl<const SCEV *> &Terms, in findArrayDimensionsRec()
7647 SmallVectorImpl<const SCEV *> &Sizes) { in findArrayDimensionsRec()
7649 const SCEV *Step = Terms[Last]; in findArrayDimensionsRec()
7654 SmallVector<const SCEV *, 2> Qs; in findArrayDimensionsRec()
7655 for (const SCEV *Op : M->operands()) in findArrayDimensionsRec()
7666 for (const SCEV *&Term : Terms) { in findArrayDimensionsRec()
7668 const SCEV *Q, *R; in findArrayDimensionsRec()
7679 Terms.erase(std::remove_if(Terms.begin(), Terms.end(), [](const SCEV *E) { in findArrayDimensionsRec()
7697 bool follow(const SCEV *S) { in follow()
7715 containsParameters(const SCEV *S) { in containsParameters()
7725 containsParameters(SmallVectorImpl<const SCEV *> &Terms) { in containsParameters()
7726 for (const SCEV *T : Terms) in containsParameters()
7733 static inline int numberOfTerms(const SCEV *S) { in numberOfTerms()
7739 static const SCEV *removeConstantFactors(ScalarEvolution &SE, const SCEV *T) { in removeConstantFactors()
7747 SmallVector<const SCEV *, 2> Factors; in removeConstantFactors()
7748 for (const SCEV *Op : M->operands()) in removeConstantFactors()
7759 const SCEV *ScalarEvolution::getElementSize(Instruction *Inst) { in getElementSize()
7774 void ScalarEvolution::findArrayDimensions(SmallVectorImpl<const SCEV *> &Terms, in findArrayDimensions()
7775 SmallVectorImpl<const SCEV *> &Sizes, in findArrayDimensions()
7776 const SCEV *ElementSize) const { in findArrayDimensions()
7788 for (const SCEV *T : Terms) in findArrayDimensions()
7797 std::sort(Terms.begin(), Terms.end(), [](const SCEV *LHS, const SCEV *RHS) { in findArrayDimensions()
7804 for (const SCEV *&Term : Terms) { in findArrayDimensions()
7805 const SCEV *Q, *R; in findArrayDimensions()
7810 SmallVector<const SCEV *, 4> NewTerms; in findArrayDimensions()
7813 for (const SCEV *T : Terms) in findArrayDimensions()
7814 if (const SCEV *NewT = removeConstantFactors(SE, T)) in findArrayDimensions()
7819 for (const SCEV *T : NewTerms) in findArrayDimensions()
7834 for (const SCEV *S : Sizes) in findArrayDimensions()
7842 ScalarEvolution &SE, SmallVectorImpl<const SCEV *> &Subscripts, in computeAccessFunctions()
7843 SmallVectorImpl<const SCEV *> &Sizes) const { in computeAccessFunctions()
7849 const SCEV *Res = this; in computeAccessFunctions()
7852 const SCEV *Q, *R; in computeAccessFunctions()
7891 for (const SCEV *S : Subscripts) in computeAccessFunctions()
7946 SmallVectorImpl<const SCEV *> &Subscripts, in delinearize()
7947 SmallVectorImpl<const SCEV *> &Sizes, in delinearize()
7948 const SCEV *ElementSize) const { in delinearize()
7950 SmallVector<const SCEV *, 4> Terms; in delinearize()
7971 for (const SCEV *S : Sizes) in delinearize()
7975 for (const SCEV *S : Subscripts) in delinearize()
8138 const SCEV *SV = SE.getSCEV(&*I); in print()
8149 const SCEV *AtUse = SE.getSCEVAtScope(SV, L); in print()
8163 const SCEV *ExitValue = SE.getSCEVAtScope(SV, L->getParentLoop()); in print()
8182 ScalarEvolution::getLoopDisposition(const SCEV *S, const Loop *L) { in getLoopDisposition()
8201 ScalarEvolution::computeLoopDisposition(const SCEV *S, const Loop *L) { in computeLoopDisposition()
8279 bool ScalarEvolution::isLoopInvariant(const SCEV *S, const Loop *L) { in isLoopInvariant()
8283 bool ScalarEvolution::hasComputableLoopEvolution(const SCEV *S, const Loop *L) { in hasComputableLoopEvolution()
8288 ScalarEvolution::getBlockDisposition(const SCEV *S, const BasicBlock *BB) { in getBlockDisposition()
8307 ScalarEvolution::computeBlockDisposition(const SCEV *S, const BasicBlock *BB) { in computeBlockDisposition()
8343 const SCEV *LHS = UDiv->getLHS(), *RHS = UDiv->getRHS(); in computeBlockDisposition()
8369 bool ScalarEvolution::dominates(const SCEV *S, const BasicBlock *BB) { in dominates()
8373 bool ScalarEvolution::properlyDominates(const SCEV *S, const BasicBlock *BB) { in properlyDominates()
8381 const SCEV *Node;
8384 SCEVSearch(const SCEV *N): Node(N), IsFound(false) {} in SCEVSearch()
8386 bool follow(const SCEV *S) { in follow()
8394 bool ScalarEvolution::hasOperand(const SCEV *S, const SCEV *Op) const { in hasOperand()
8400 void ScalarEvolution::forgetMemoizedResults(const SCEV *S) { in forgetMemoizedResults()