Lines Matching refs:Ops
793 static void GroupByComplexity(SmallVectorImpl<const SCEV *> &Ops, in GroupByComplexity() argument
795 if (Ops.size() < 2) return; // Noop in GroupByComplexity()
806 if (Ops.size() == 2) { in GroupByComplexity()
809 const SCEV *&LHS = Ops[0], *&RHS = Ops[1]; in GroupByComplexity()
816 llvm::stable_sort(Ops, [&](const SCEV *LHS, const SCEV *RHS) { in GroupByComplexity()
824 for (unsigned i = 0, e = Ops.size(); i != e-2; ++i) { in GroupByComplexity()
825 const SCEV *S = Ops[i]; in GroupByComplexity()
830 for (unsigned j = i+1; j != e && Ops[j]->getSCEVType() == Complexity; ++j) { in GroupByComplexity()
831 if (Ops[j] == S) { // Found a duplicate. in GroupByComplexity()
833 std::swap(Ops[i+1], Ops[j]); in GroupByComplexity()
843 static bool hasHugeExpression(ArrayRef<const SCEV *> Ops) { in hasHugeExpression() argument
844 return any_of(Ops, [](const SCEV *S) { in hasHugeExpression()
1786 SmallVector<const SCEV *, 4> Ops; in getZeroExtendExprImpl() local
1788 Ops.push_back(getZeroExtendExpr(Op, Ty, Depth + 1)); in getZeroExtendExprImpl()
1789 return getAddExpr(Ops, SCEV::FlagNUW, Depth + 1); in getZeroExtendExprImpl()
1819 SmallVector<const SCEV *, 4> Ops; in getZeroExtendExprImpl() local
1821 Ops.push_back(getZeroExtendExpr(Op, Ty, Depth + 1)); in getZeroExtendExprImpl()
1822 return getMulExpr(Ops, SCEV::FlagNUW, Depth + 1); in getZeroExtendExprImpl()
1958 SmallVector<const SCEV *, 4> Ops; in getSignExtendExprImpl() local
1960 Ops.push_back(getSignExtendExpr(Op, Ty, Depth + 1)); in getSignExtendExprImpl()
1961 return getAddExpr(Ops, SCEV::FlagNSW, Depth + 1); in getSignExtendExprImpl()
2197 SmallVector<const SCEV *, 4> Ops; in getAnyExtendExpr() local
2199 Ops.push_back(getAnyExtendExpr(Op, Ty)); in getAnyExtendExpr()
2200 return getAddRecExpr(Ops, AR->getLoop(), SCEV::FlagNW); in getAnyExtendExpr()
2238 ArrayRef<const SCEV *> Ops, const APInt &Scale, in CollectAddOperandsWithScales() argument
2244 while (const SCEVConstant *C = dyn_cast<SCEVConstant>(Ops[i])) { in CollectAddOperandsWithScales()
2254 for (; i != Ops.size(); ++i) { in CollectAddOperandsWithScales()
2255 const SCEVMulExpr *Mul = dyn_cast<SCEVMulExpr>(Ops[i]); in CollectAddOperandsWithScales()
2283 M.insert({Ops[i], Scale}); in CollectAddOperandsWithScales()
2424 const ArrayRef<const SCEV *> Ops, in StrengthenNoWrapFlags() argument
2444 if (SignOrUnsignWrap == SCEV::FlagNSW && all_of(Ops, IsKnownNonNegative)) in StrengthenNoWrapFlags()
2451 (Type == scAddExpr || Type == scMulExpr) && Ops.size() == 2 && in StrengthenNoWrapFlags()
2452 isa<SCEVConstant>(Ops[0])) { in StrengthenNoWrapFlags()
2465 const APInt &C = cast<SCEVConstant>(Ops[0])->getAPInt(); in StrengthenNoWrapFlags()
2471 if (NSWRegion.contains(SE->getSignedRange(Ops[1]))) in StrengthenNoWrapFlags()
2479 if (NUWRegion.contains(SE->getUnsignedRange(Ops[1]))) in StrengthenNoWrapFlags()
2487 !ScalarEvolution::hasFlags(Flags, SCEV::FlagNUW) && Ops.size() == 2 && in StrengthenNoWrapFlags()
2488 Ops[0]->isZero() && IsKnownNonNegative(Ops[1])) in StrengthenNoWrapFlags()
2493 Ops.size() == 2) { in StrengthenNoWrapFlags()
2494 if (auto *UDiv = dyn_cast<SCEVUDivExpr>(Ops[0])) in StrengthenNoWrapFlags()
2495 if (UDiv->getOperand(1) == Ops[1]) in StrengthenNoWrapFlags()
2497 if (auto *UDiv = dyn_cast<SCEVUDivExpr>(Ops[1])) in StrengthenNoWrapFlags()
2498 if (UDiv->getOperand(1) == Ops[0]) in StrengthenNoWrapFlags()
2510 const SCEV *ScalarEvolution::getAddExpr(SmallVectorImpl<const SCEV *> &Ops, in getAddExpr() argument
2515 assert(!Ops.empty() && "Cannot get empty add!"); in getAddExpr()
2516 if (Ops.size() == 1) return Ops[0]; in getAddExpr()
2518 Type *ETy = getEffectiveSCEVType(Ops[0]->getType()); in getAddExpr()
2519 for (unsigned i = 1, e = Ops.size(); i != e; ++i) in getAddExpr()
2520 assert(getEffectiveSCEVType(Ops[i]->getType()) == ETy && in getAddExpr()
2523 Ops, [](const SCEV *Op) { return Op->getType()->isPointerTy(); }); in getAddExpr()
2528 GroupByComplexity(Ops, &LI, DT); in getAddExpr()
2532 if (const SCEVConstant *LHSC = dyn_cast<SCEVConstant>(Ops[0])) { in getAddExpr()
2534 assert(Idx < Ops.size()); in getAddExpr()
2535 while (const SCEVConstant *RHSC = dyn_cast<SCEVConstant>(Ops[Idx])) { in getAddExpr()
2537 Ops[0] = getConstant(LHSC->getAPInt() + RHSC->getAPInt()); in getAddExpr()
2538 if (Ops.size() == 2) return Ops[0]; in getAddExpr()
2539 Ops.erase(Ops.begin()+1); // Erase the folded element in getAddExpr()
2540 LHSC = cast<SCEVConstant>(Ops[0]); in getAddExpr()
2545 Ops.erase(Ops.begin()); in getAddExpr()
2549 if (Ops.size() == 1) return Ops[0]; in getAddExpr()
2553 auto ComputeFlags = [this, OrigFlags](const ArrayRef<const SCEV *> Ops) { in getAddExpr() argument
2554 return StrengthenNoWrapFlags(this, scAddExpr, Ops, OrigFlags); in getAddExpr()
2558 if (Depth > MaxArithDepth || hasHugeExpression(Ops)) in getAddExpr()
2559 return getOrCreateAddExpr(Ops, ComputeFlags(Ops)); in getAddExpr()
2561 if (SCEV *S = findExistingSCEVInCache(scAddExpr, Ops)) { in getAddExpr()
2565 Add->setNoWrapFlags(ComputeFlags(Ops)); in getAddExpr()
2572 Type *Ty = Ops[0]->getType(); in getAddExpr()
2574 for (unsigned i = 0, e = Ops.size(); i != e-1; ++i) in getAddExpr()
2575 if (Ops[i] == Ops[i+1]) { // X + Y + Y --> X + Y*2 in getAddExpr()
2578 while (i+Count != e && Ops[i+Count] == Ops[i]) in getAddExpr()
2582 const SCEV *Mul = getMulExpr(Scale, Ops[i], SCEV::FlagAnyWrap, Depth + 1); in getAddExpr()
2583 if (Ops.size() == Count) in getAddExpr()
2585 Ops[i] = Mul; in getAddExpr()
2586 Ops.erase(Ops.begin()+i+1, Ops.begin()+i+Count); in getAddExpr()
2591 return getAddExpr(Ops, OrigFlags, Depth + 1); in getAddExpr()
2602 if (auto *T = dyn_cast<SCEVTruncateExpr>(Ops[Idx])) in getAddExpr()
2604 if (const auto *Mul = dyn_cast<SCEVMulExpr>(Ops[Idx])) { in getAddExpr()
2616 for (unsigned i = 0, e = Ops.size(); i != e; ++i) { in getAddExpr()
2617 if (const SCEVTruncateExpr *T = dyn_cast<SCEVTruncateExpr>(Ops[i])) { in getAddExpr()
2623 } else if (const SCEVConstant *C = dyn_cast<SCEVConstant>(Ops[i])) { in getAddExpr()
2625 } else if (const SCEVMulExpr *M = dyn_cast<SCEVMulExpr>(Ops[i])) { in getAddExpr()
2658 if (Ops.size() == 2) { in getAddExpr()
2662 const SCEV *A = Ops[0]; in getAddExpr()
2663 const SCEV *B = Ops[1]; in getAddExpr()
2698 if (Ops.size() == 2) { in getAddExpr()
2699 const SCEVMulExpr *Mul = dyn_cast<SCEVMulExpr>(Ops[0]); in getAddExpr()
2704 if (matchURem(Mul->getOperand(1), X, Y) && X == Ops[1]) { in getAddExpr()
2711 while (Idx < Ops.size() && Ops[Idx]->getSCEVType() < scAddExpr) in getAddExpr()
2715 if (Idx < Ops.size()) { in getAddExpr()
2721 while (const SCEVAddExpr *Add = dyn_cast<SCEVAddExpr>(Ops[Idx])) { in getAddExpr()
2722 if (Ops.size() > AddOpsInlineThreshold || in getAddExpr()
2727 Ops.erase(Ops.begin()+Idx); in getAddExpr()
2728 append_range(Ops, Add->operands()); in getAddExpr()
2737 return getAddExpr(Ops, CommonFlags, Depth + 1); in getAddExpr()
2741 while (Idx < Ops.size() && Ops[Idx]->getSCEVType() < scMulExpr) in getAddExpr()
2746 if (Idx < Ops.size() && isa<SCEVMulExpr>(Ops[Idx])) { in getAddExpr()
2752 Ops, APInt(BitWidth, 1), *this)) { in getAddExpr()
2766 Ops.clear(); in getAddExpr()
2768 Ops.push_back(getConstant(AccumulatedConstant)); in getAddExpr()
2771 Ops.push_back(getAddExpr(MulOp.second, SCEV::FlagAnyWrap, Depth + 1)); in getAddExpr()
2773 Ops.push_back(getMulExpr( in getAddExpr()
2779 if (Ops.empty()) in getAddExpr()
2781 if (Ops.size() == 1) in getAddExpr()
2782 return Ops[0]; in getAddExpr()
2783 return getAddExpr(Ops, SCEV::FlagAnyWrap, Depth + 1); in getAddExpr()
2790 for (; Idx < Ops.size() && isa<SCEVMulExpr>(Ops[Idx]); ++Idx) { in getAddExpr()
2791 const SCEVMulExpr *Mul = cast<SCEVMulExpr>(Ops[Idx]); in getAddExpr()
2796 for (unsigned AddOp = 0, e = Ops.size(); AddOp != e; ++AddOp) in getAddExpr()
2797 if (MulOpSCEV == Ops[AddOp]) { in getAddExpr()
2812 if (Ops.size() == 2) return OuterMul; in getAddExpr()
2814 Ops.erase(Ops.begin()+AddOp); in getAddExpr()
2815 Ops.erase(Ops.begin()+Idx-1); in getAddExpr()
2817 Ops.erase(Ops.begin()+Idx); in getAddExpr()
2818 Ops.erase(Ops.begin()+AddOp-1); in getAddExpr()
2820 Ops.push_back(OuterMul); in getAddExpr()
2821 return getAddExpr(Ops, SCEV::FlagAnyWrap, Depth + 1); in getAddExpr()
2826 OtherMulIdx < Ops.size() && isa<SCEVMulExpr>(Ops[OtherMulIdx]); in getAddExpr()
2828 const SCEVMulExpr *OtherMul = cast<SCEVMulExpr>(Ops[OtherMulIdx]); in getAddExpr()
2854 if (Ops.size() == 2) return OuterMul; in getAddExpr()
2855 Ops.erase(Ops.begin()+Idx); in getAddExpr()
2856 Ops.erase(Ops.begin()+OtherMulIdx-1); in getAddExpr()
2857 Ops.push_back(OuterMul); in getAddExpr()
2858 return getAddExpr(Ops, SCEV::FlagAnyWrap, Depth + 1); in getAddExpr()
2867 while (Idx < Ops.size() && Ops[Idx]->getSCEVType() < scAddRecExpr) in getAddExpr()
2871 for (; Idx < Ops.size() && isa<SCEVAddRecExpr>(Ops[Idx]); ++Idx) { in getAddExpr()
2875 const SCEVAddRecExpr *AddRec = cast<SCEVAddRecExpr>(Ops[Idx]); in getAddExpr()
2877 for (unsigned i = 0, e = Ops.size(); i != e; ++i) in getAddExpr()
2878 if (isAvailableAtLoopEntry(Ops[i], AddRecLoop)) { in getAddExpr()
2879 LIOps.push_back(Ops[i]); in getAddExpr()
2880 Ops.erase(Ops.begin()+i); in getAddExpr()
2924 if (Ops.size() == 1) return NewRec; in getAddExpr()
2928 if (Ops[i] == AddRec) { in getAddExpr()
2929 Ops[i] = NewRec; in getAddExpr()
2932 return getAddExpr(Ops, SCEV::FlagAnyWrap, Depth + 1); in getAddExpr()
2939 OtherIdx < Ops.size() && isa<SCEVAddRecExpr>(Ops[OtherIdx]); in getAddExpr()
2944 cast<SCEVAddRecExpr>(Ops[OtherIdx])->getLoop()->getHeader(), in getAddExpr()
2947 if (AddRecLoop == cast<SCEVAddRecExpr>(Ops[OtherIdx])->getLoop()) { in getAddExpr()
2950 for (; OtherIdx != Ops.size() && isa<SCEVAddRecExpr>(Ops[OtherIdx]); in getAddExpr()
2952 const auto *OtherAddRec = cast<SCEVAddRecExpr>(Ops[OtherIdx]); in getAddExpr()
2964 Ops.erase(Ops.begin() + OtherIdx); --OtherIdx; in getAddExpr()
2968 Ops[Idx] = getAddRecExpr(AddRecOps, AddRecLoop, SCEV::FlagAnyWrap); in getAddExpr()
2969 return getAddExpr(Ops, SCEV::FlagAnyWrap, Depth + 1); in getAddExpr()
2979 return getOrCreateAddExpr(Ops, ComputeFlags(Ops)); in getAddExpr()
2983 ScalarEvolution::getOrCreateAddExpr(ArrayRef<const SCEV *> Ops, in getOrCreateAddExpr() argument
2987 for (const SCEV *Op : Ops) in getOrCreateAddExpr()
2993 const SCEV **O = SCEVAllocator.Allocate<const SCEV *>(Ops.size()); in getOrCreateAddExpr()
2994 std::uninitialized_copy(Ops.begin(), Ops.end(), O); in getOrCreateAddExpr()
2996 SCEVAddExpr(ID.Intern(SCEVAllocator), O, Ops.size()); in getOrCreateAddExpr()
2998 registerUser(S, Ops); in getOrCreateAddExpr()
3005 ScalarEvolution::getOrCreateAddRecExpr(ArrayRef<const SCEV *> Ops, in getOrCreateAddRecExpr() argument
3009 for (const SCEV *Op : Ops) in getOrCreateAddRecExpr()
3016 const SCEV **O = SCEVAllocator.Allocate<const SCEV *>(Ops.size()); in getOrCreateAddRecExpr()
3017 std::uninitialized_copy(Ops.begin(), Ops.end(), O); in getOrCreateAddRecExpr()
3019 SCEVAddRecExpr(ID.Intern(SCEVAllocator), O, Ops.size(), L); in getOrCreateAddRecExpr()
3022 registerUser(S, Ops); in getOrCreateAddRecExpr()
3029 ScalarEvolution::getOrCreateMulExpr(ArrayRef<const SCEV *> Ops, in getOrCreateMulExpr() argument
3033 for (const SCEV *Op : Ops) in getOrCreateMulExpr()
3039 const SCEV **O = SCEVAllocator.Allocate<const SCEV *>(Ops.size()); in getOrCreateMulExpr()
3040 std::uninitialized_copy(Ops.begin(), Ops.end(), O); in getOrCreateMulExpr()
3042 O, Ops.size()); in getOrCreateMulExpr()
3044 registerUser(S, Ops); in getOrCreateMulExpr()
3105 const SCEV *ScalarEvolution::getMulExpr(SmallVectorImpl<const SCEV *> &Ops, in getMulExpr() argument
3110 assert(!Ops.empty() && "Cannot get empty mul!"); in getMulExpr()
3111 if (Ops.size() == 1) return Ops[0]; in getMulExpr()
3113 Type *ETy = Ops[0]->getType(); in getMulExpr()
3115 for (unsigned i = 1, e = Ops.size(); i != e; ++i) in getMulExpr()
3116 assert(Ops[i]->getType() == ETy && in getMulExpr()
3121 GroupByComplexity(Ops, &LI, DT); in getMulExpr()
3125 if (const SCEVConstant *LHSC = dyn_cast<SCEVConstant>(Ops[0])) { in getMulExpr()
3127 assert(Idx < Ops.size()); in getMulExpr()
3128 while (const SCEVConstant *RHSC = dyn_cast<SCEVConstant>(Ops[Idx])) { in getMulExpr()
3130 Ops[0] = getConstant(LHSC->getAPInt() * RHSC->getAPInt()); in getMulExpr()
3131 if (Ops.size() == 2) return Ops[0]; in getMulExpr()
3132 Ops.erase(Ops.begin()+1); // Erase the folded element in getMulExpr()
3133 LHSC = cast<SCEVConstant>(Ops[0]); in getMulExpr()
3142 Ops.erase(Ops.begin()); in getMulExpr()
3146 if (Ops.size() == 1) in getMulExpr()
3147 return Ops[0]; in getMulExpr()
3151 auto ComputeFlags = [this, OrigFlags](const ArrayRef<const SCEV *> Ops) { in getMulExpr() argument
3152 return StrengthenNoWrapFlags(this, scMulExpr, Ops, OrigFlags); in getMulExpr()
3156 if (Depth > MaxArithDepth || hasHugeExpression(Ops)) in getMulExpr()
3157 return getOrCreateMulExpr(Ops, ComputeFlags(Ops)); in getMulExpr()
3159 if (SCEV *S = findExistingSCEVInCache(scMulExpr, Ops)) { in getMulExpr()
3163 Mul->setNoWrapFlags(ComputeFlags(Ops)); in getMulExpr()
3167 if (const SCEVConstant *LHSC = dyn_cast<SCEVConstant>(Ops[0])) { in getMulExpr()
3168 if (Ops.size() == 2) { in getMulExpr()
3170 if (const SCEVAddExpr *Add = dyn_cast<SCEVAddExpr>(Ops[1])) in getMulExpr()
3185 if (Ops[0]->isAllOnesValue()) { in getMulExpr()
3188 if (const SCEVAddExpr *Add = dyn_cast<SCEVAddExpr>(Ops[1])) { in getMulExpr()
3192 const SCEV *Mul = getMulExpr(Ops[0], AddOp, SCEV::FlagAnyWrap, in getMulExpr()
3199 } else if (const auto *AddRec = dyn_cast<SCEVAddRecExpr>(Ops[1])) { in getMulExpr()
3203 Operands.push_back(getMulExpr(Ops[0], AddRecOp, SCEV::FlagAnyWrap, in getMulExpr()
3225 while (Idx < Ops.size() && Ops[Idx]->getSCEVType() < scMulExpr) in getMulExpr()
3229 if (Idx < Ops.size()) { in getMulExpr()
3231 while (const SCEVMulExpr *Mul = dyn_cast<SCEVMulExpr>(Ops[Idx])) { in getMulExpr()
3232 if (Ops.size() > MulOpsInlineThreshold) in getMulExpr()
3236 Ops.erase(Ops.begin()+Idx); in getMulExpr()
3237 append_range(Ops, Mul->operands()); in getMulExpr()
3245 return getMulExpr(Ops, SCEV::FlagAnyWrap, Depth + 1); in getMulExpr()
3251 while (Idx < Ops.size() && Ops[Idx]->getSCEVType() < scAddRecExpr) in getMulExpr()
3255 for (; Idx < Ops.size() && isa<SCEVAddRecExpr>(Ops[Idx]); ++Idx) { in getMulExpr()
3259 const SCEVAddRecExpr *AddRec = cast<SCEVAddRecExpr>(Ops[Idx]); in getMulExpr()
3260 for (unsigned i = 0, e = Ops.size(); i != e; ++i) in getMulExpr()
3261 if (isAvailableAtLoopEntry(Ops[i], AddRec->getLoop())) { in getMulExpr()
3262 LIOps.push_back(Ops[i]); in getMulExpr()
3263 Ops.erase(Ops.begin()+i); in getMulExpr()
3297 if (Ops.size() == 1) return NewRec; in getMulExpr()
3301 if (Ops[i] == AddRec) { in getMulExpr()
3302 Ops[i] = NewRec; in getMulExpr()
3305 return getMulExpr(Ops, SCEV::FlagAnyWrap, Depth + 1); in getMulExpr()
3324 OtherIdx != Ops.size() && isa<SCEVAddRecExpr>(Ops[OtherIdx]); in getMulExpr()
3327 dyn_cast<SCEVAddRecExpr>(Ops[OtherIdx]); in getMulExpr()
3369 if (Ops.size() == 2) return NewAddRec; in getMulExpr()
3370 Ops[Idx] = NewAddRec; in getMulExpr()
3371 Ops.erase(Ops.begin() + OtherIdx); --OtherIdx; in getMulExpr()
3379 return getMulExpr(Ops, SCEV::FlagAnyWrap, Depth + 1); in getMulExpr()
3387 return getOrCreateMulExpr(Ops, ComputeFlags(Ops)); in getMulExpr()
3816 ArrayRef<const SCEV *> Ops) { in findExistingSCEVInCache() argument
3819 for (const SCEV *Op : Ops) in findExistingSCEVInCache()
3831 SmallVectorImpl<const SCEV *> &Ops) { in getMinMaxExpr() argument
3833 assert(!Ops.empty() && "Cannot get empty (u|s)(min|max)!"); in getMinMaxExpr()
3834 if (Ops.size() == 1) return Ops[0]; in getMinMaxExpr()
3836 Type *ETy = getEffectiveSCEVType(Ops[0]->getType()); in getMinMaxExpr()
3837 for (unsigned i = 1, e = Ops.size(); i != e; ++i) { in getMinMaxExpr()
3838 assert(getEffectiveSCEVType(Ops[i]->getType()) == ETy && in getMinMaxExpr()
3840 assert(Ops[0]->getType()->isPointerTy() == in getMinMaxExpr()
3841 Ops[i]->getType()->isPointerTy() && in getMinMaxExpr()
3850 GroupByComplexity(Ops, &LI, DT); in getMinMaxExpr()
3853 if (const SCEV *S = findExistingSCEVInCache(Kind, Ops)) { in getMinMaxExpr()
3859 if (const SCEVConstant *LHSC = dyn_cast<SCEVConstant>(Ops[0])) { in getMinMaxExpr()
3861 assert(Idx < Ops.size()); in getMinMaxExpr()
3877 while (const SCEVConstant *RHSC = dyn_cast<SCEVConstant>(Ops[Idx])) { in getMinMaxExpr()
3881 Ops[0] = getConstant(Fold); in getMinMaxExpr()
3882 Ops.erase(Ops.begin()+1); // Erase the folded element in getMinMaxExpr()
3883 if (Ops.size() == 1) return Ops[0]; in getMinMaxExpr()
3884 LHSC = cast<SCEVConstant>(Ops[0]); in getMinMaxExpr()
3892 Ops.erase(Ops.begin()); in getMinMaxExpr()
3900 if (Ops.size() == 1) return Ops[0]; in getMinMaxExpr()
3904 while (Idx < Ops.size() && Ops[Idx]->getSCEVType() < Kind) in getMinMaxExpr()
3909 if (Idx < Ops.size()) { in getMinMaxExpr()
3911 while (Ops[Idx]->getSCEVType() == Kind) { in getMinMaxExpr()
3912 const SCEVMinMaxExpr *SMME = cast<SCEVMinMaxExpr>(Ops[Idx]); in getMinMaxExpr()
3913 Ops.erase(Ops.begin()+Idx); in getMinMaxExpr()
3914 append_range(Ops, SMME->operands()); in getMinMaxExpr()
3919 return getMinMaxExpr(Kind, Ops); in getMinMaxExpr()
3931 for (unsigned i = 0, e = Ops.size() - 1; i != e; ++i) { in getMinMaxExpr()
3932 if (Ops[i] == Ops[i + 1] || in getMinMaxExpr()
3933 isKnownViaNonRecursiveReasoning(FirstPred, Ops[i], Ops[i + 1])) { in getMinMaxExpr()
3936 Ops.erase(Ops.begin() + i + 1, Ops.begin() + i + 2); in getMinMaxExpr()
3939 } else if (isKnownViaNonRecursiveReasoning(SecondPred, Ops[i], in getMinMaxExpr()
3940 Ops[i + 1])) { in getMinMaxExpr()
3942 Ops.erase(Ops.begin() + i, Ops.begin() + i + 1); in getMinMaxExpr()
3948 if (Ops.size() == 1) return Ops[0]; in getMinMaxExpr()
3950 assert(!Ops.empty() && "Reduced smax down to nothing!"); in getMinMaxExpr()
3956 for (unsigned i = 0, e = Ops.size(); i != e; ++i) in getMinMaxExpr()
3957 ID.AddPointer(Ops[i]); in getMinMaxExpr()
3962 const SCEV **O = SCEVAllocator.Allocate<const SCEV *>(Ops.size()); in getMinMaxExpr()
3963 std::uninitialized_copy(Ops.begin(), Ops.end(), O); in getMinMaxExpr()
3965 SCEVMinMaxExpr(ID.Intern(SCEVAllocator), Kind, O, Ops.size()); in getMinMaxExpr()
3968 registerUser(S, Ops); in getMinMaxExpr()
4031 SmallVector<const SCEV *> Ops; in visit() local
4032 Ops.reserve(OrigOps.size()); in visit()
4039 Ops.emplace_back(*NewOp); in visit()
4043 NewOps = std::move(Ops); in visit()
4251 SmallVectorImpl<const SCEV *> &Ops) { in getSequentialMinMaxExpr() argument
4254 assert(!Ops.empty() && "Cannot get empty (u|s)(min|max)!"); in getSequentialMinMaxExpr()
4255 if (Ops.size() == 1) in getSequentialMinMaxExpr()
4256 return Ops[0]; in getSequentialMinMaxExpr()
4258 Type *ETy = getEffectiveSCEVType(Ops[0]->getType()); in getSequentialMinMaxExpr()
4259 for (unsigned i = 1, e = Ops.size(); i != e; ++i) { in getSequentialMinMaxExpr()
4260 assert(getEffectiveSCEVType(Ops[i]->getType()) == ETy && in getSequentialMinMaxExpr()
4262 assert(Ops[0]->getType()->isPointerTy() == in getSequentialMinMaxExpr()
4263 Ops[i]->getType()->isPointerTy() && in getSequentialMinMaxExpr()
4272 if (const SCEV *S = findExistingSCEVInCache(Kind, Ops)) in getSequentialMinMaxExpr()
4280 bool Changed = Deduplicator.visit(Kind, Ops, Ops); in getSequentialMinMaxExpr()
4282 return getSequentialMinMaxExpr(Kind, Ops); in getSequentialMinMaxExpr()
4290 while (Idx < Ops.size()) { in getSequentialMinMaxExpr()
4291 if (Ops[Idx]->getSCEVType() != Kind) { in getSequentialMinMaxExpr()
4295 const auto *SMME = cast<SCEVSequentialMinMaxExpr>(Ops[Idx]); in getSequentialMinMaxExpr()
4296 Ops.erase(Ops.begin() + Idx); in getSequentialMinMaxExpr()
4297 Ops.insert(Ops.begin() + Idx, SMME->operands().begin(), in getSequentialMinMaxExpr()
4303 return getSequentialMinMaxExpr(Kind, Ops); in getSequentialMinMaxExpr()
4310 SaturationPoint = getZero(Ops[0]->getType()); in getSequentialMinMaxExpr()
4317 for (unsigned i = 1, e = Ops.size(); i != e; ++i) { in getSequentialMinMaxExpr()
4321 if (::impliesPoison(Ops[i], Ops[i - 1]) || in getSequentialMinMaxExpr()
4322 isKnownViaNonRecursiveReasoning(ICmpInst::ICMP_NE, Ops[i - 1], in getSequentialMinMaxExpr()
4324 SmallVector<const SCEV *> SeqOps = {Ops[i - 1], Ops[i]}; in getSequentialMinMaxExpr()
4325 Ops[i - 1] = getMinMaxExpr( in getSequentialMinMaxExpr()
4328 Ops.erase(Ops.begin() + i); in getSequentialMinMaxExpr()
4329 return getSequentialMinMaxExpr(Kind, Ops); in getSequentialMinMaxExpr()
4333 if (isKnownViaNonRecursiveReasoning(Pred, Ops[i - 1], Ops[i])) { in getSequentialMinMaxExpr()
4334 Ops.erase(Ops.begin() + i); in getSequentialMinMaxExpr()
4335 return getSequentialMinMaxExpr(Kind, Ops); in getSequentialMinMaxExpr()
4343 for (unsigned i = 0, e = Ops.size(); i != e; ++i) in getSequentialMinMaxExpr()
4344 ID.AddPointer(Ops[i]); in getSequentialMinMaxExpr()
4350 const SCEV **O = SCEVAllocator.Allocate<const SCEV *>(Ops.size()); in getSequentialMinMaxExpr()
4351 std::uninitialized_copy(Ops.begin(), Ops.end(), O); in getSequentialMinMaxExpr()
4353 SCEVSequentialMinMaxExpr(ID.Intern(SCEVAllocator), Kind, O, Ops.size()); in getSequentialMinMaxExpr()
4356 registerUser(S, Ops); in getSequentialMinMaxExpr()
4361 SmallVector<const SCEV *, 2> Ops = {LHS, RHS}; in getSMaxExpr() local
4362 return getSMaxExpr(Ops); in getSMaxExpr()
4365 const SCEV *ScalarEvolution::getSMaxExpr(SmallVectorImpl<const SCEV *> &Ops) { in getSMaxExpr() argument
4366 return getMinMaxExpr(scSMaxExpr, Ops); in getSMaxExpr()
4370 SmallVector<const SCEV *, 2> Ops = {LHS, RHS}; in getUMaxExpr() local
4371 return getUMaxExpr(Ops); in getUMaxExpr()
4374 const SCEV *ScalarEvolution::getUMaxExpr(SmallVectorImpl<const SCEV *> &Ops) { in getUMaxExpr() argument
4375 return getMinMaxExpr(scUMaxExpr, Ops); in getUMaxExpr()
4380 SmallVector<const SCEV *, 2> Ops = { LHS, RHS }; in getSMinExpr() local
4381 return getSMinExpr(Ops); in getSMinExpr()
4384 const SCEV *ScalarEvolution::getSMinExpr(SmallVectorImpl<const SCEV *> &Ops) { in getSMinExpr() argument
4385 return getMinMaxExpr(scSMinExpr, Ops); in getSMinExpr()
4390 SmallVector<const SCEV *, 2> Ops = { LHS, RHS }; in getUMinExpr() local
4391 return getUMinExpr(Ops, Sequential); in getUMinExpr()
4394 const SCEV *ScalarEvolution::getUMinExpr(SmallVectorImpl<const SCEV *> &Ops, in getUMinExpr() argument
4396 return Sequential ? getSequentialMinMaxExpr(scSequentialUMinExpr, Ops) in getUMinExpr()
4397 : getMinMaxExpr(scUMinExpr, Ops); in getUMinExpr()
4647 SmallVector<const SCEV *> Ops{AddRec->operands()}; in removePointerBase() local
4648 Ops[0] = removePointerBase(Ops[0]); in removePointerBase()
4651 return getAddRecExpr(Ops, AddRec->getLoop(), SCEV::FlagAnyWrap); in removePointerBase()
4655 SmallVector<const SCEV *> Ops{Add->operands()}; in removePointerBase() local
4657 for (const SCEV *&AddOp : Ops) { in removePointerBase()
4666 return getAddExpr(Ops); in removePointerBase()
4810 SmallVector<const SCEV *, 2> Ops = { LHS, RHS }; in getUMinFromMismatchedTypes() local
4811 return getUMinFromMismatchedTypes(Ops, Sequential); in getUMinFromMismatchedTypes()
4815 ScalarEvolution::getUMinFromMismatchedTypes(SmallVectorImpl<const SCEV *> &Ops, in getUMinFromMismatchedTypes() argument
4817 assert(!Ops.empty() && "At least one operand must be!"); in getUMinFromMismatchedTypes()
4819 if (Ops.size() == 1) in getUMinFromMismatchedTypes()
4820 return Ops[0]; in getUMinFromMismatchedTypes()
4824 for (const auto *S : Ops) in getUMinFromMismatchedTypes()
4833 for (const auto *S : Ops) in getUMinFromMismatchedTypes()
5528 SmallVector<const SCEV *, 8> Ops; in createAddRecFromPHIWithCastsImpl() local
5531 Ops.push_back(Add->getOperand(i)); in createAddRecFromPHIWithCastsImpl()
5532 const SCEV *Accum = getAddExpr(Ops); in createAddRecFromPHIWithCastsImpl()
5858 SmallVector<const SCEV *, 8> Ops; in createAddRecFromPHI() local
5861 Ops.push_back(SCEVBackedgeConditionFolder::rewrite(Add->getOperand(i), in createAddRecFromPHI()
5863 const SCEV *Accum = getAddExpr(Ops); in createAddRecFromPHI()
7248 ScalarEvolution::getDefiningScopeBound(ArrayRef<const SCEV *> Ops, in getDefiningScopeBound() argument
7265 for (const auto *S : Ops) in getDefiningScopeBound()
7283 ScalarEvolution::getDefiningScopeBound(ArrayRef<const SCEV *> Ops) { in getDefiningScopeBound() argument
7285 return getDefiningScopeBound(Ops, Discard); in getDefiningScopeBound()
7434 SmallVector<Value *> Ops; in createSCEVIter() local
7443 CreatedSCEV = getOperandsToCreate(CurV, Ops); in createSCEVIter()
7452 for (Value *Op : Ops) in createSCEVIter()
7461 ScalarEvolution::getOperandsToCreate(Value *V, SmallVectorImpl<Value *> &Ops) { in getOperandsToCreate() argument
7492 Ops.push_back(BO->Op); in getOperandsToCreate()
7496 Ops.push_back(BO->RHS); in getOperandsToCreate()
7505 Ops.push_back(BO->LHS); in getOperandsToCreate()
7513 Ops.push_back(BO->LHS); in getOperandsToCreate()
7543 Ops.push_back(BO->LHS); in getOperandsToCreate()
7544 Ops.push_back(BO->RHS); in getOperandsToCreate()
7553 Ops.push_back(U->getOperand(0)); in getOperandsToCreate()
7558 Ops.push_back(U->getOperand(0)); in getOperandsToCreate()
7565 Ops.push_back(U->getOperand(0)); in getOperandsToCreate()
7566 Ops.push_back(U->getOperand(1)); in getOperandsToCreate()
7573 Ops.push_back(Index); in getOperandsToCreate()
7607 Ops.push_back(Inc); in getOperandsToCreate()
7614 Ops.push_back(RV); in getOperandsToCreate()
7621 Ops.push_back(II->getArgOperand(0)); in getOperandsToCreate()
7629 Ops.push_back(II->getArgOperand(0)); in getOperandsToCreate()
7630 Ops.push_back(II->getArgOperand(1)); in getOperandsToCreate()
7635 Ops.push_back(II->getArgOperand(0)); in getOperandsToCreate()
8569 SmallVector<const SCEV *, 2> Ops; in getExact() local
8577 Ops.push_back(BECount); in getExact()
8590 return SE->getUMinFromMismatchedTypes(Ops, /* Sequential */ true); in getExact()
9902 ArrayRef<const SCEV *> Ops = V->operands(); in computeSCEVAtScope() local
9905 for (unsigned i = 0, e = Ops.size(); i != e; ++i) { in computeSCEVAtScope()
9906 const SCEV *OpAtScope = getSCEVAtScope(Ops[i], L); in computeSCEVAtScope()
9907 if (OpAtScope != Ops[i]) { in computeSCEVAtScope()
9911 NewOps.reserve(Ops.size()); in computeSCEVAtScope()
9912 append_range(NewOps, Ops.take_front(i)); in computeSCEVAtScope()
9916 OpAtScope = getSCEVAtScope(Ops[i], L); in computeSCEVAtScope()
13309 SmallVector<const SCEV *, 3> Ops; in getPostIncExpr() local
13313 Ops.push_back(SE.getAddExpr(getOperand(i), getOperand(i + 1))); in getPostIncExpr()
13320 Ops.push_back(Last); in getPostIncExpr()
13321 return cast<SCEVAddRecExpr>(SE.getAddRecExpr(Ops, getLoop(), in getPostIncExpr()
14714 ArrayRef<const SCEV *> Ops) { in registerUser() argument
14715 for (const auto *Op : Ops) in registerUser()
15137 SmallVector<const SCEV *> Ops = { in applyLoopGuards() local
15139 return getMinMaxExpr(SCTy, Ops); in applyLoopGuards()