Lines Matching refs:Ops

863 static void GroupByComplexity(SmallVectorImpl<const SCEV *> &Ops,  in GroupByComplexity()  argument
865 if (Ops.size() < 2) return; // Noop in GroupByComplexity()
876 if (Ops.size() == 2) { in GroupByComplexity()
879 const SCEV *&LHS = Ops[0], *&RHS = Ops[1]; in GroupByComplexity()
886 llvm::stable_sort(Ops, [&](const SCEV *LHS, const SCEV *RHS) { in GroupByComplexity()
894 for (unsigned i = 0, e = Ops.size(); i != e-2; ++i) { in GroupByComplexity()
895 const SCEV *S = Ops[i]; in GroupByComplexity()
900 for (unsigned j = i+1; j != e && Ops[j]->getSCEVType() == Complexity; ++j) { in GroupByComplexity()
901 if (Ops[j] == S) { // Found a duplicate. in GroupByComplexity()
903 std::swap(Ops[i+1], Ops[j]); in GroupByComplexity()
913 static bool hasHugeExpression(ArrayRef<const SCEV *> Ops) { in hasHugeExpression() argument
914 return any_of(Ops, [](const SCEV *S) { in hasHugeExpression()
1819 SmallVector<const SCEV *, 4> Ops; in getZeroExtendExpr() local
1821 Ops.push_back(getZeroExtendExpr(Op, Ty, Depth + 1)); in getZeroExtendExpr()
1822 return getAddExpr(Ops, SCEV::FlagNUW, Depth + 1); in getZeroExtendExpr()
1852 SmallVector<const SCEV *, 4> Ops; in getZeroExtendExpr() local
1854 Ops.push_back(getZeroExtendExpr(Op, Ty, Depth + 1)); in getZeroExtendExpr()
1855 return getMulExpr(Ops, SCEV::FlagNUW, Depth + 1); in getZeroExtendExpr()
1952 SmallVector<const SCEV *, 4> Ops; in getSignExtendExpr() local
1954 Ops.push_back(getSignExtendExpr(Op, Ty, Depth + 1)); in getSignExtendExpr()
1955 return getAddExpr(Ops, SCEV::FlagNSW, Depth + 1); in getSignExtendExpr()
2184 SmallVector<const SCEV *, 4> Ops; in getAnyExtendExpr() local
2186 Ops.push_back(getAnyExtendExpr(Op, Ty)); in getAnyExtendExpr()
2187 return getAddRecExpr(Ops, AR->getLoop(), SCEV::FlagNW); in getAnyExtendExpr()
2225 const SCEV *const *Ops, size_t NumOperands, in CollectAddOperandsWithScales() argument
2232 while (const SCEVConstant *C = dyn_cast<SCEVConstant>(Ops[i])) { in CollectAddOperandsWithScales()
2243 const SCEVMulExpr *Mul = dyn_cast<SCEVMulExpr>(Ops[i]); in CollectAddOperandsWithScales()
2272 M.insert({Ops[i], Scale}); in CollectAddOperandsWithScales()
2370 const ArrayRef<const SCEV *> Ops, in StrengthenNoWrapFlags() argument
2390 if (SignOrUnsignWrap == SCEV::FlagNSW && all_of(Ops, IsKnownNonNegative)) in StrengthenNoWrapFlags()
2397 (Type == scAddExpr || Type == scMulExpr) && Ops.size() == 2 && in StrengthenNoWrapFlags()
2398 isa<SCEVConstant>(Ops[0])) { in StrengthenNoWrapFlags()
2411 const APInt &C = cast<SCEVConstant>(Ops[0])->getAPInt(); in StrengthenNoWrapFlags()
2417 if (NSWRegion.contains(SE->getSignedRange(Ops[1]))) in StrengthenNoWrapFlags()
2425 if (NUWRegion.contains(SE->getUnsignedRange(Ops[1]))) in StrengthenNoWrapFlags()
2433 !ScalarEvolution::hasFlags(Flags, SCEV::FlagNUW) && Ops.size() == 2 && in StrengthenNoWrapFlags()
2434 Ops[0]->isZero() && IsKnownNonNegative(Ops[1])) in StrengthenNoWrapFlags()
2439 Ops.size() == 2) { in StrengthenNoWrapFlags()
2440 if (auto *UDiv = dyn_cast<SCEVUDivExpr>(Ops[0])) in StrengthenNoWrapFlags()
2441 if (UDiv->getOperand(1) == Ops[1]) in StrengthenNoWrapFlags()
2443 if (auto *UDiv = dyn_cast<SCEVUDivExpr>(Ops[1])) in StrengthenNoWrapFlags()
2444 if (UDiv->getOperand(1) == Ops[0]) in StrengthenNoWrapFlags()
2456 const SCEV *ScalarEvolution::getAddExpr(SmallVectorImpl<const SCEV *> &Ops, in getAddExpr() argument
2461 assert(!Ops.empty() && "Cannot get empty add!"); in getAddExpr()
2462 if (Ops.size() == 1) return Ops[0]; in getAddExpr()
2464 Type *ETy = getEffectiveSCEVType(Ops[0]->getType()); in getAddExpr()
2465 for (unsigned i = 1, e = Ops.size(); i != e; ++i) in getAddExpr()
2466 assert(getEffectiveSCEVType(Ops[i]->getType()) == ETy && in getAddExpr()
2469 Ops, [](const SCEV *Op) { return Op->getType()->isPointerTy(); }); in getAddExpr()
2474 GroupByComplexity(Ops, &LI, DT); in getAddExpr()
2478 if (const SCEVConstant *LHSC = dyn_cast<SCEVConstant>(Ops[0])) { in getAddExpr()
2480 assert(Idx < Ops.size()); in getAddExpr()
2481 while (const SCEVConstant *RHSC = dyn_cast<SCEVConstant>(Ops[Idx])) { in getAddExpr()
2483 Ops[0] = getConstant(LHSC->getAPInt() + RHSC->getAPInt()); in getAddExpr()
2484 if (Ops.size() == 2) return Ops[0]; in getAddExpr()
2485 Ops.erase(Ops.begin()+1); // Erase the folded element in getAddExpr()
2486 LHSC = cast<SCEVConstant>(Ops[0]); in getAddExpr()
2491 Ops.erase(Ops.begin()); in getAddExpr()
2495 if (Ops.size() == 1) return Ops[0]; in getAddExpr()
2499 auto ComputeFlags = [this, OrigFlags](const ArrayRef<const SCEV *> Ops) { in getAddExpr() argument
2500 return StrengthenNoWrapFlags(this, scAddExpr, Ops, OrigFlags); in getAddExpr()
2504 if (Depth > MaxArithDepth || hasHugeExpression(Ops)) in getAddExpr()
2505 return getOrCreateAddExpr(Ops, ComputeFlags(Ops)); in getAddExpr()
2507 if (SCEV *S = findExistingSCEVInCache(scAddExpr, Ops)) { in getAddExpr()
2511 Add->setNoWrapFlags(ComputeFlags(Ops)); in getAddExpr()
2518 Type *Ty = Ops[0]->getType(); in getAddExpr()
2520 for (unsigned i = 0, e = Ops.size(); i != e-1; ++i) in getAddExpr()
2521 if (Ops[i] == Ops[i+1]) { // X + Y + Y --> X + Y*2 in getAddExpr()
2524 while (i+Count != e && Ops[i+Count] == Ops[i]) in getAddExpr()
2528 const SCEV *Mul = getMulExpr(Scale, Ops[i], SCEV::FlagAnyWrap, Depth + 1); in getAddExpr()
2529 if (Ops.size() == Count) in getAddExpr()
2531 Ops[i] = Mul; in getAddExpr()
2532 Ops.erase(Ops.begin()+i+1, Ops.begin()+i+Count); in getAddExpr()
2537 return getAddExpr(Ops, OrigFlags, Depth + 1); in getAddExpr()
2548 if (auto *T = dyn_cast<SCEVTruncateExpr>(Ops[Idx])) in getAddExpr()
2550 if (const auto *Mul = dyn_cast<SCEVMulExpr>(Ops[Idx])) { in getAddExpr()
2562 for (unsigned i = 0, e = Ops.size(); i != e; ++i) { in getAddExpr()
2563 if (const SCEVTruncateExpr *T = dyn_cast<SCEVTruncateExpr>(Ops[i])) { in getAddExpr()
2569 } else if (const SCEVConstant *C = dyn_cast<SCEVConstant>(Ops[i])) { in getAddExpr()
2571 } else if (const SCEVMulExpr *M = dyn_cast<SCEVMulExpr>(Ops[i])) { in getAddExpr()
2604 if (Ops.size() == 2) { in getAddExpr()
2608 const SCEV *A = Ops[0]; in getAddExpr()
2609 const SCEV *B = Ops[1]; in getAddExpr()
2644 if (Ops.size() == 2) { in getAddExpr()
2645 const SCEVMulExpr *Mul = dyn_cast<SCEVMulExpr>(Ops[0]); in getAddExpr()
2650 if (matchURem(Mul->getOperand(1), X, Y) && X == Ops[1]) { in getAddExpr()
2657 while (Idx < Ops.size() && Ops[Idx]->getSCEVType() < scAddExpr) in getAddExpr()
2661 if (Idx < Ops.size()) { in getAddExpr()
2667 while (const SCEVAddExpr *Add = dyn_cast<SCEVAddExpr>(Ops[Idx])) { in getAddExpr()
2668 if (Ops.size() > AddOpsInlineThreshold || in getAddExpr()
2673 Ops.erase(Ops.begin()+Idx); in getAddExpr()
2674 Ops.append(Add->op_begin(), Add->op_end()); in getAddExpr()
2683 return getAddExpr(Ops, CommonFlags, Depth + 1); in getAddExpr()
2687 while (Idx < Ops.size() && Ops[Idx]->getSCEVType() < scMulExpr) in getAddExpr()
2692 if (Idx < Ops.size() && isa<SCEVMulExpr>(Ops[Idx])) { in getAddExpr()
2698 Ops.data(), Ops.size(), in getAddExpr()
2713 Ops.clear(); in getAddExpr()
2715 Ops.push_back(getConstant(AccumulatedConstant)); in getAddExpr()
2718 Ops.push_back(getAddExpr(MulOp.second, SCEV::FlagAnyWrap, Depth + 1)); in getAddExpr()
2720 Ops.push_back(getMulExpr( in getAddExpr()
2726 if (Ops.empty()) in getAddExpr()
2728 if (Ops.size() == 1) in getAddExpr()
2729 return Ops[0]; in getAddExpr()
2730 return getAddExpr(Ops, SCEV::FlagAnyWrap, Depth + 1); in getAddExpr()
2737 for (; Idx < Ops.size() && isa<SCEVMulExpr>(Ops[Idx]); ++Idx) { in getAddExpr()
2738 const SCEVMulExpr *Mul = cast<SCEVMulExpr>(Ops[Idx]); in getAddExpr()
2743 for (unsigned AddOp = 0, e = Ops.size(); AddOp != e; ++AddOp) in getAddExpr()
2744 if (MulOpSCEV == Ops[AddOp]) { in getAddExpr()
2759 if (Ops.size() == 2) return OuterMul; in getAddExpr()
2761 Ops.erase(Ops.begin()+AddOp); in getAddExpr()
2762 Ops.erase(Ops.begin()+Idx-1); in getAddExpr()
2764 Ops.erase(Ops.begin()+Idx); in getAddExpr()
2765 Ops.erase(Ops.begin()+AddOp-1); in getAddExpr()
2767 Ops.push_back(OuterMul); in getAddExpr()
2768 return getAddExpr(Ops, SCEV::FlagAnyWrap, Depth + 1); in getAddExpr()
2773 OtherMulIdx < Ops.size() && isa<SCEVMulExpr>(Ops[OtherMulIdx]); in getAddExpr()
2775 const SCEVMulExpr *OtherMul = cast<SCEVMulExpr>(Ops[OtherMulIdx]); in getAddExpr()
2801 if (Ops.size() == 2) return OuterMul; in getAddExpr()
2802 Ops.erase(Ops.begin()+Idx); in getAddExpr()
2803 Ops.erase(Ops.begin()+OtherMulIdx-1); in getAddExpr()
2804 Ops.push_back(OuterMul); in getAddExpr()
2805 return getAddExpr(Ops, SCEV::FlagAnyWrap, Depth + 1); in getAddExpr()
2814 while (Idx < Ops.size() && Ops[Idx]->getSCEVType() < scAddRecExpr) in getAddExpr()
2818 for (; Idx < Ops.size() && isa<SCEVAddRecExpr>(Ops[Idx]); ++Idx) { in getAddExpr()
2822 const SCEVAddRecExpr *AddRec = cast<SCEVAddRecExpr>(Ops[Idx]); in getAddExpr()
2824 for (unsigned i = 0, e = Ops.size(); i != e; ++i) in getAddExpr()
2825 if (isAvailableAtLoopEntry(Ops[i], AddRecLoop)) { in getAddExpr()
2826 LIOps.push_back(Ops[i]); in getAddExpr()
2827 Ops.erase(Ops.begin()+i); in getAddExpr()
2871 if (Ops.size() == 1) return NewRec; in getAddExpr()
2875 if (Ops[i] == AddRec) { in getAddExpr()
2876 Ops[i] = NewRec; in getAddExpr()
2879 return getAddExpr(Ops, SCEV::FlagAnyWrap, Depth + 1); in getAddExpr()
2886 OtherIdx < Ops.size() && isa<SCEVAddRecExpr>(Ops[OtherIdx]); in getAddExpr()
2891 cast<SCEVAddRecExpr>(Ops[OtherIdx])->getLoop()->getHeader(), in getAddExpr()
2894 if (AddRecLoop == cast<SCEVAddRecExpr>(Ops[OtherIdx])->getLoop()) { in getAddExpr()
2897 for (; OtherIdx != Ops.size() && isa<SCEVAddRecExpr>(Ops[OtherIdx]); in getAddExpr()
2899 const auto *OtherAddRec = cast<SCEVAddRecExpr>(Ops[OtherIdx]); in getAddExpr()
2912 Ops.erase(Ops.begin() + OtherIdx); --OtherIdx; in getAddExpr()
2916 Ops[Idx] = getAddRecExpr(AddRecOps, AddRecLoop, SCEV::FlagAnyWrap); in getAddExpr()
2917 return getAddExpr(Ops, SCEV::FlagAnyWrap, Depth + 1); in getAddExpr()
2927 return getOrCreateAddExpr(Ops, ComputeFlags(Ops)); in getAddExpr()
2931 ScalarEvolution::getOrCreateAddExpr(ArrayRef<const SCEV *> Ops, in getOrCreateAddExpr() argument
2935 for (const SCEV *Op : Ops) in getOrCreateAddExpr()
2941 const SCEV **O = SCEVAllocator.Allocate<const SCEV *>(Ops.size()); in getOrCreateAddExpr()
2942 std::uninitialized_copy(Ops.begin(), Ops.end(), O); in getOrCreateAddExpr()
2944 SCEVAddExpr(ID.Intern(SCEVAllocator), O, Ops.size()); in getOrCreateAddExpr()
2946 registerUser(S, Ops); in getOrCreateAddExpr()
2953 ScalarEvolution::getOrCreateAddRecExpr(ArrayRef<const SCEV *> Ops, in getOrCreateAddRecExpr() argument
2957 for (const SCEV *Op : Ops) in getOrCreateAddRecExpr()
2964 const SCEV **O = SCEVAllocator.Allocate<const SCEV *>(Ops.size()); in getOrCreateAddRecExpr()
2965 std::uninitialized_copy(Ops.begin(), Ops.end(), O); in getOrCreateAddRecExpr()
2967 SCEVAddRecExpr(ID.Intern(SCEVAllocator), O, Ops.size(), L); in getOrCreateAddRecExpr()
2970 registerUser(S, Ops); in getOrCreateAddRecExpr()
2977 ScalarEvolution::getOrCreateMulExpr(ArrayRef<const SCEV *> Ops, in getOrCreateMulExpr() argument
2981 for (const SCEV *Op : Ops) in getOrCreateMulExpr()
2987 const SCEV **O = SCEVAllocator.Allocate<const SCEV *>(Ops.size()); in getOrCreateMulExpr()
2988 std::uninitialized_copy(Ops.begin(), Ops.end(), O); in getOrCreateMulExpr()
2990 O, Ops.size()); in getOrCreateMulExpr()
2992 registerUser(S, Ops); in getOrCreateMulExpr()
3053 const SCEV *ScalarEvolution::getMulExpr(SmallVectorImpl<const SCEV *> &Ops, in getMulExpr() argument
3058 assert(!Ops.empty() && "Cannot get empty mul!"); in getMulExpr()
3059 if (Ops.size() == 1) return Ops[0]; in getMulExpr()
3061 Type *ETy = Ops[0]->getType(); in getMulExpr()
3063 for (unsigned i = 1, e = Ops.size(); i != e; ++i) in getMulExpr()
3064 assert(Ops[i]->getType() == ETy && in getMulExpr()
3069 GroupByComplexity(Ops, &LI, DT); in getMulExpr()
3073 if (const SCEVConstant *LHSC = dyn_cast<SCEVConstant>(Ops[0])) { in getMulExpr()
3075 assert(Idx < Ops.size()); in getMulExpr()
3076 while (const SCEVConstant *RHSC = dyn_cast<SCEVConstant>(Ops[Idx])) { in getMulExpr()
3078 Ops[0] = getConstant(LHSC->getAPInt() * RHSC->getAPInt()); in getMulExpr()
3079 if (Ops.size() == 2) return Ops[0]; in getMulExpr()
3080 Ops.erase(Ops.begin()+1); // Erase the folded element in getMulExpr()
3081 LHSC = cast<SCEVConstant>(Ops[0]); in getMulExpr()
3090 Ops.erase(Ops.begin()); in getMulExpr()
3094 if (Ops.size() == 1) in getMulExpr()
3095 return Ops[0]; in getMulExpr()
3099 auto ComputeFlags = [this, OrigFlags](const ArrayRef<const SCEV *> Ops) { in getMulExpr() argument
3100 return StrengthenNoWrapFlags(this, scMulExpr, Ops, OrigFlags); in getMulExpr()
3104 if (Depth > MaxArithDepth || hasHugeExpression(Ops)) in getMulExpr()
3105 return getOrCreateMulExpr(Ops, ComputeFlags(Ops)); in getMulExpr()
3107 if (SCEV *S = findExistingSCEVInCache(scMulExpr, Ops)) { in getMulExpr()
3111 Mul->setNoWrapFlags(ComputeFlags(Ops)); in getMulExpr()
3115 if (const SCEVConstant *LHSC = dyn_cast<SCEVConstant>(Ops[0])) { in getMulExpr()
3116 if (Ops.size() == 2) { in getMulExpr()
3118 if (const SCEVAddExpr *Add = dyn_cast<SCEVAddExpr>(Ops[1])) in getMulExpr()
3133 if (Ops[0]->isAllOnesValue()) { in getMulExpr()
3136 if (const SCEVAddExpr *Add = dyn_cast<SCEVAddExpr>(Ops[1])) { in getMulExpr()
3140 const SCEV *Mul = getMulExpr(Ops[0], AddOp, SCEV::FlagAnyWrap, in getMulExpr()
3147 } else if (const auto *AddRec = dyn_cast<SCEVAddRecExpr>(Ops[1])) { in getMulExpr()
3151 Operands.push_back(getMulExpr(Ops[0], AddRecOp, SCEV::FlagAnyWrap, in getMulExpr()
3162 while (Idx < Ops.size() && Ops[Idx]->getSCEVType() < scMulExpr) in getMulExpr()
3166 if (Idx < Ops.size()) { in getMulExpr()
3168 while (const SCEVMulExpr *Mul = dyn_cast<SCEVMulExpr>(Ops[Idx])) { in getMulExpr()
3169 if (Ops.size() > MulOpsInlineThreshold) in getMulExpr()
3173 Ops.erase(Ops.begin()+Idx); in getMulExpr()
3174 Ops.append(Mul->op_begin(), Mul->op_end()); in getMulExpr()
3182 return getMulExpr(Ops, SCEV::FlagAnyWrap, Depth + 1); in getMulExpr()
3188 while (Idx < Ops.size() && Ops[Idx]->getSCEVType() < scAddRecExpr) in getMulExpr()
3192 for (; Idx < Ops.size() && isa<SCEVAddRecExpr>(Ops[Idx]); ++Idx) { in getMulExpr()
3196 const SCEVAddRecExpr *AddRec = cast<SCEVAddRecExpr>(Ops[Idx]); in getMulExpr()
3198 for (unsigned i = 0, e = Ops.size(); i != e; ++i) in getMulExpr()
3199 if (isAvailableAtLoopEntry(Ops[i], AddRecLoop)) { in getMulExpr()
3200 LIOps.push_back(Ops[i]); in getMulExpr()
3201 Ops.erase(Ops.begin()+i); in getMulExpr()
3225 if (Ops.size() == 1) return NewRec; in getMulExpr()
3229 if (Ops[i] == AddRec) { in getMulExpr()
3230 Ops[i] = NewRec; in getMulExpr()
3233 return getMulExpr(Ops, SCEV::FlagAnyWrap, Depth + 1); in getMulExpr()
3252 OtherIdx != Ops.size() && isa<SCEVAddRecExpr>(Ops[OtherIdx]); in getMulExpr()
3255 dyn_cast<SCEVAddRecExpr>(Ops[OtherIdx]); in getMulExpr()
3297 if (Ops.size() == 2) return NewAddRec; in getMulExpr()
3298 Ops[Idx] = NewAddRec; in getMulExpr()
3299 Ops.erase(Ops.begin() + OtherIdx); --OtherIdx; in getMulExpr()
3307 return getMulExpr(Ops, SCEV::FlagAnyWrap, Depth + 1); in getMulExpr()
3315 return getOrCreateMulExpr(Ops, ComputeFlags(Ops)); in getMulExpr()
3744 ArrayRef<const SCEV *> Ops) { in findExistingSCEVInCache() argument
3747 for (const SCEV *Op : Ops) in findExistingSCEVInCache()
3759 SmallVectorImpl<const SCEV *> &Ops) { in getMinMaxExpr() argument
3761 assert(!Ops.empty() && "Cannot get empty (u|s)(min|max)!"); in getMinMaxExpr()
3762 if (Ops.size() == 1) return Ops[0]; in getMinMaxExpr()
3764 Type *ETy = getEffectiveSCEVType(Ops[0]->getType()); in getMinMaxExpr()
3765 for (unsigned i = 1, e = Ops.size(); i != e; ++i) { in getMinMaxExpr()
3766 assert(getEffectiveSCEVType(Ops[i]->getType()) == ETy && in getMinMaxExpr()
3768 assert(Ops[0]->getType()->isPointerTy() == in getMinMaxExpr()
3769 Ops[i]->getType()->isPointerTy() && in getMinMaxExpr()
3778 GroupByComplexity(Ops, &LI, DT); in getMinMaxExpr()
3781 if (const SCEV *S = findExistingSCEVInCache(Kind, Ops)) { in getMinMaxExpr()
3787 if (const SCEVConstant *LHSC = dyn_cast<SCEVConstant>(Ops[0])) { in getMinMaxExpr()
3789 assert(Idx < Ops.size()); in getMinMaxExpr()
3802 while (const SCEVConstant *RHSC = dyn_cast<SCEVConstant>(Ops[Idx])) { in getMinMaxExpr()
3806 Ops[0] = getConstant(Fold); in getMinMaxExpr()
3807 Ops.erase(Ops.begin()+1); // Erase the folded element in getMinMaxExpr()
3808 if (Ops.size() == 1) return Ops[0]; in getMinMaxExpr()
3809 LHSC = cast<SCEVConstant>(Ops[0]); in getMinMaxExpr()
3817 Ops.erase(Ops.begin()); in getMinMaxExpr()
3825 if (Ops.size() == 1) return Ops[0]; in getMinMaxExpr()
3829 while (Idx < Ops.size() && Ops[Idx]->getSCEVType() < Kind) in getMinMaxExpr()
3834 if (Idx < Ops.size()) { in getMinMaxExpr()
3836 while (Ops[Idx]->getSCEVType() == Kind) { in getMinMaxExpr()
3837 const SCEVMinMaxExpr *SMME = cast<SCEVMinMaxExpr>(Ops[Idx]); in getMinMaxExpr()
3838 Ops.erase(Ops.begin()+Idx); in getMinMaxExpr()
3839 Ops.append(SMME->op_begin(), SMME->op_end()); in getMinMaxExpr()
3844 return getMinMaxExpr(Kind, Ops); in getMinMaxExpr()
3856 for (unsigned i = 0, e = Ops.size() - 1; i != e; ++i) { in getMinMaxExpr()
3857 if (Ops[i] == Ops[i + 1] || in getMinMaxExpr()
3858 isKnownViaNonRecursiveReasoning(FirstPred, Ops[i], Ops[i + 1])) { in getMinMaxExpr()
3861 Ops.erase(Ops.begin() + i + 1, Ops.begin() + i + 2); in getMinMaxExpr()
3864 } else if (isKnownViaNonRecursiveReasoning(SecondPred, Ops[i], in getMinMaxExpr()
3865 Ops[i + 1])) { in getMinMaxExpr()
3867 Ops.erase(Ops.begin() + i, Ops.begin() + i + 1); in getMinMaxExpr()
3873 if (Ops.size() == 1) return Ops[0]; in getMinMaxExpr()
3875 assert(!Ops.empty() && "Reduced smax down to nothing!"); in getMinMaxExpr()
3881 for (unsigned i = 0, e = Ops.size(); i != e; ++i) in getMinMaxExpr()
3882 ID.AddPointer(Ops[i]); in getMinMaxExpr()
3887 const SCEV **O = SCEVAllocator.Allocate<const SCEV *>(Ops.size()); in getMinMaxExpr()
3888 std::uninitialized_copy(Ops.begin(), Ops.end(), O); in getMinMaxExpr()
3890 SCEVMinMaxExpr(ID.Intern(SCEVAllocator), Kind, O, Ops.size()); in getMinMaxExpr()
3893 registerUser(S, Ops); in getMinMaxExpr()
3957 SmallVector<const SCEV *> Ops; in visit() local
3958 Ops.reserve(OrigOps.size()); in visit()
3965 Ops.emplace_back(*NewOp); in visit()
3969 NewOps = std::move(Ops); in visit()
4073 SmallVectorImpl<const SCEV *> &Ops) { in getSequentialMinMaxExpr() argument
4076 assert(!Ops.empty() && "Cannot get empty (u|s)(min|max)!"); in getSequentialMinMaxExpr()
4077 if (Ops.size() == 1) in getSequentialMinMaxExpr()
4078 return Ops[0]; in getSequentialMinMaxExpr()
4080 Type *ETy = getEffectiveSCEVType(Ops[0]->getType()); in getSequentialMinMaxExpr()
4081 for (unsigned i = 1, e = Ops.size(); i != e; ++i) { in getSequentialMinMaxExpr()
4082 assert(getEffectiveSCEVType(Ops[i]->getType()) == ETy && in getSequentialMinMaxExpr()
4084 assert(Ops[0]->getType()->isPointerTy() == in getSequentialMinMaxExpr()
4085 Ops[i]->getType()->isPointerTy() && in getSequentialMinMaxExpr()
4094 if (const SCEV *S = findExistingSCEVInCache(Kind, Ops)) in getSequentialMinMaxExpr()
4102 bool Changed = Deduplicator.visit(Kind, Ops, Ops); in getSequentialMinMaxExpr()
4104 return getSequentialMinMaxExpr(Kind, Ops); in getSequentialMinMaxExpr()
4112 while (Idx < Ops.size()) { in getSequentialMinMaxExpr()
4113 if (Ops[Idx]->getSCEVType() != Kind) { in getSequentialMinMaxExpr()
4117 const auto *SMME = cast<SCEVSequentialMinMaxExpr>(Ops[Idx]); in getSequentialMinMaxExpr()
4118 Ops.erase(Ops.begin() + Idx); in getSequentialMinMaxExpr()
4119 Ops.insert(Ops.begin() + Idx, SMME->op_begin(), SMME->op_end()); in getSequentialMinMaxExpr()
4124 return getSequentialMinMaxExpr(Kind, Ops); in getSequentialMinMaxExpr()
4131 SaturationPoint = getZero(Ops[0]->getType()); in getSequentialMinMaxExpr()
4138 for (unsigned i = 1, e = Ops.size(); i != e; ++i) { in getSequentialMinMaxExpr()
4142 if (::impliesPoison(Ops[i], Ops[i - 1]) || in getSequentialMinMaxExpr()
4143 isKnownViaNonRecursiveReasoning(ICmpInst::ICMP_NE, Ops[i - 1], in getSequentialMinMaxExpr()
4145 SmallVector<const SCEV *> SeqOps = {Ops[i - 1], Ops[i]}; in getSequentialMinMaxExpr()
4146 Ops[i - 1] = getMinMaxExpr( in getSequentialMinMaxExpr()
4149 Ops.erase(Ops.begin() + i); in getSequentialMinMaxExpr()
4150 return getSequentialMinMaxExpr(Kind, Ops); in getSequentialMinMaxExpr()
4154 if (isKnownViaNonRecursiveReasoning(Pred, Ops[i - 1], Ops[i])) { in getSequentialMinMaxExpr()
4155 Ops.erase(Ops.begin() + i); in getSequentialMinMaxExpr()
4156 return getSequentialMinMaxExpr(Kind, Ops); in getSequentialMinMaxExpr()
4164 for (unsigned i = 0, e = Ops.size(); i != e; ++i) in getSequentialMinMaxExpr()
4165 ID.AddPointer(Ops[i]); in getSequentialMinMaxExpr()
4171 const SCEV **O = SCEVAllocator.Allocate<const SCEV *>(Ops.size()); in getSequentialMinMaxExpr()
4172 std::uninitialized_copy(Ops.begin(), Ops.end(), O); in getSequentialMinMaxExpr()
4174 SCEVSequentialMinMaxExpr(ID.Intern(SCEVAllocator), Kind, O, Ops.size()); in getSequentialMinMaxExpr()
4177 registerUser(S, Ops); in getSequentialMinMaxExpr()
4182 SmallVector<const SCEV *, 2> Ops = {LHS, RHS}; in getSMaxExpr() local
4183 return getSMaxExpr(Ops); in getSMaxExpr()
4186 const SCEV *ScalarEvolution::getSMaxExpr(SmallVectorImpl<const SCEV *> &Ops) { in getSMaxExpr() argument
4187 return getMinMaxExpr(scSMaxExpr, Ops); in getSMaxExpr()
4191 SmallVector<const SCEV *, 2> Ops = {LHS, RHS}; in getUMaxExpr() local
4192 return getUMaxExpr(Ops); in getUMaxExpr()
4195 const SCEV *ScalarEvolution::getUMaxExpr(SmallVectorImpl<const SCEV *> &Ops) { in getUMaxExpr() argument
4196 return getMinMaxExpr(scUMaxExpr, Ops); in getUMaxExpr()
4201 SmallVector<const SCEV *, 2> Ops = { LHS, RHS }; in getSMinExpr() local
4202 return getSMinExpr(Ops); in getSMinExpr()
4205 const SCEV *ScalarEvolution::getSMinExpr(SmallVectorImpl<const SCEV *> &Ops) { in getSMinExpr() argument
4206 return getMinMaxExpr(scSMinExpr, Ops); in getSMinExpr()
4211 SmallVector<const SCEV *, 2> Ops = { LHS, RHS }; in getUMinExpr() local
4212 return getUMinExpr(Ops, Sequential); in getUMinExpr()
4215 const SCEV *ScalarEvolution::getUMinExpr(SmallVectorImpl<const SCEV *> &Ops, in getUMinExpr() argument
4217 return Sequential ? getSequentialMinMaxExpr(scSequentialUMinExpr, Ops) in getUMinExpr()
4218 : getMinMaxExpr(scUMinExpr, Ops); in getUMinExpr()
4488 SmallVector<const SCEV *> Ops{AddRec->operands()}; in removePointerBase() local
4489 Ops[0] = removePointerBase(Ops[0]); in removePointerBase()
4492 return getAddRecExpr(Ops, AddRec->getLoop(), SCEV::FlagAnyWrap); in removePointerBase()
4496 SmallVector<const SCEV *> Ops{Add->operands()}; in removePointerBase() local
4498 for (const SCEV *&AddOp : Ops) { in removePointerBase()
4507 return getAddExpr(Ops); in removePointerBase()
4651 SmallVector<const SCEV *, 2> Ops = { LHS, RHS }; in getUMinFromMismatchedTypes() local
4652 return getUMinFromMismatchedTypes(Ops, Sequential); in getUMinFromMismatchedTypes()
4656 ScalarEvolution::getUMinFromMismatchedTypes(SmallVectorImpl<const SCEV *> &Ops, in getUMinFromMismatchedTypes() argument
4658 assert(!Ops.empty() && "At least one operand must be!"); in getUMinFromMismatchedTypes()
4660 if (Ops.size() == 1) in getUMinFromMismatchedTypes()
4661 return Ops[0]; in getUMinFromMismatchedTypes()
4665 for (const auto *S : Ops) in getUMinFromMismatchedTypes()
4674 for (const auto *S : Ops) in getUMinFromMismatchedTypes()
5339 SmallVector<const SCEV *, 8> Ops; in createAddRecFromPHIWithCastsImpl() local
5342 Ops.push_back(Add->getOperand(i)); in createAddRecFromPHIWithCastsImpl()
5343 const SCEV *Accum = getAddExpr(Ops); in createAddRecFromPHIWithCastsImpl()
5663 SmallVector<const SCEV *, 8> Ops; in createAddRecFromPHI() local
5666 Ops.push_back(SCEVBackedgeConditionFolder::rewrite(Add->getOperand(i), in createAddRecFromPHI()
5668 const SCEV *Accum = getAddExpr(Ops); in createAddRecFromPHI()
6981 SmallVectorImpl<const SCEV *> &Ops) { in collectUniqueOps() argument
6985 Ops.push_back(S); in collectUniqueOps()
6999 ScalarEvolution::getDefiningScopeBound(ArrayRef<const SCEV *> Ops, in getDefiningScopeBound() argument
7016 for (const auto *S : Ops) in getDefiningScopeBound()
7026 SmallVector<const SCEV *, 4> Ops; in getDefiningScopeBound() local
7027 collectUniqueOps(S, Ops); in getDefiningScopeBound()
7028 for (const auto *Op : Ops) in getDefiningScopeBound()
7036 ScalarEvolution::getDefiningScopeBound(ArrayRef<const SCEV *> Ops) { in getDefiningScopeBound() argument
7038 return getDefiningScopeBound(Ops, Discard); in getDefiningScopeBound()
7205 SmallVector<Value *> Ops; in createSCEVIter() local
7214 CreatedSCEV = getOperandsToCreate(CurV, Ops); in createSCEVIter()
7223 for (Value *Op : Ops) in createSCEVIter()
7232 ScalarEvolution::getOperandsToCreate(Value *V, SmallVectorImpl<Value *> &Ops) { in getOperandsToCreate() argument
7247 Ops.push_back(GA->getAliasee()); in getOperandsToCreate()
7265 Ops.push_back(BO->Op); in getOperandsToCreate()
7269 Ops.push_back(BO->RHS); in getOperandsToCreate()
7273 Ops.push_back(BO->LHS); in getOperandsToCreate()
7285 Ops.push_back(BO->Op); in getOperandsToCreate()
7289 Ops.push_back(BO->RHS); in getOperandsToCreate()
7292 Ops.push_back(BO->LHS); in getOperandsToCreate()
7321 Ops.push_back(BO->LHS); in getOperandsToCreate()
7322 Ops.push_back(BO->RHS); in getOperandsToCreate()
7331 Ops.push_back(U->getOperand(0)); in getOperandsToCreate()
7336 Ops.push_back(U->getOperand(0)); in getOperandsToCreate()
7343 Ops.push_back(U->getOperand(0)); in getOperandsToCreate()
7344 Ops.push_back(U->getOperand(1)); in getOperandsToCreate()
7351 Ops.push_back(Index); in getOperandsToCreate()
7385 Ops.push_back(Inc); in getOperandsToCreate()
7392 Ops.push_back(RV); in getOperandsToCreate()
7399 Ops.push_back(II->getArgOperand(0)); in getOperandsToCreate()
7407 Ops.push_back(II->getArgOperand(0)); in getOperandsToCreate()
7408 Ops.push_back(II->getArgOperand(1)); in getOperandsToCreate()
7413 Ops.push_back(II->getArgOperand(0)); in getOperandsToCreate()
8380 SmallVector<const SCEV *, 2> Ops; in getExact() local
8388 Ops.push_back(BECount); in getExact()
8401 return SE->getUMinFromMismatchedTypes(Ops, /* Sequential */ true); in getExact()
12989 SmallVector<const SCEV *, 3> Ops; in getPostIncExpr() local
12993 Ops.push_back(SE.getAddExpr(getOperand(i), getOperand(i + 1))); in getPostIncExpr()
13000 Ops.push_back(Last); in getPostIncExpr()
13001 return cast<SCEVAddRecExpr>(SE.getAddRecExpr(Ops, getLoop(), in getPostIncExpr()
13831 SmallVector<const SCEV *, 4> Ops; in verify() local
13832 collectUniqueOps(&S, Ops); in verify()
13833 for (const auto *Op : Ops) { in verify()
14308 ArrayRef<const SCEV *> Ops) { in registerUser() argument
14309 for (const auto *Op : Ops) in registerUser()