39 unsigned Opcode = VPI->getOpcode();
41 case Instruction::ExtractValue:
42 case Instruction::FCmp:
43 case Instruction::ICmp:
44 case Instruction::Select:
45 case Instruction::Freeze:
50 return Op != VPI->getOperand(0);
59 for (
unsigned I = 0;
I != Worklist.
size(); ++
I) {
64 else if (!U->usesFirstLaneOnly(Cur))
72 return all_of(Def->users(),
73 [](
const VPUser *U) { return U->usesFirstPartOnly(); });
77 return all_of(Def->users(),
78 [Def](
const VPUser *U) { return U->usesScalars(Def); });
84 return U->usesScalars(Def) ||
85 match(U, m_ExtractElement(m_Specific(Def), m_ConstantInt(Lane)));
105 Expanded->insertBefore(Iter);
115 auto PropagatesPoisonFromRecipeOp = [](
const VPRecipeBase *R) {
124 while (!Worklist.
empty()) {
126 if (!Visited.
insert(Current).second)
133 if (MemR->getAddr() == Current)
138 unsigned Opcode = Rep->getOpcode();
139 if ((Opcode == Instruction::Load && Rep->getOperand(0) == Current) ||
140 (Opcode == Instruction::Store && Rep->getOperand(1) == Current))
145 for (
const VPValue *
Op : R->operands()) {
146 if (
Op == Current && PropagatesPoisonFromRecipeOp(R)) {
147 Worklist.
push_back(R->getVPSingleValue());
161 unsigned Opcode = PtrVPI->getOpcode();
162 if (Opcode == Instruction::GetElementPtr) {
164 return PtrVPI->getGEPNoWrapFlags();
165 Ptr = PtrVPI->getOperand(0);
168 if (Opcode != Instruction::BitCast && Opcode != Instruction::AddrSpaceCast)
170 Ptr = PtrVPI->getOperand(0);
180 assert(RV == RV->getDefiningRegion()->getCanonicalIV() &&
181 "RegionValue must be canonical IV");
189 Value *LiveIn = V->getUnderlyingValue();
277 (*Mask + 1).isPowerOf2())
347 Type *SourceElementType;
367 if (R->isTruncated())
409std::optional<int64_t>
413 "should not try to widen irregular types");
427 return all_of(PtrAdd->operands(), [&SE, L](
const SCEV *
Op) {
428 return SE.isLoopInvariant(Op, L) ||
429 match(Op, m_scev_SExt(m_scev_AffineAddRec(m_SCEV(), m_SCEV()))) ||
430 match(Op, m_scev_AffineAddRec(m_SCEV(), m_SCEV()));
451 .
Default([](
auto *) {
return 0; });
454std::optional<std::pair<bool, unsigned>>
457 return std::make_pair(
true, IID);
459 return std::make_pair(
false, Opcode);
469 case Instruction::Freeze:
470 case Instruction::GetElementPtr:
471 case Instruction::ICmp:
472 case Instruction::FCmp:
473 case Instruction::Select:
495 return RV == RV->getDefiningRegion()->getCanonicalIV();
516 return VPI->doesGenerateSingleScalar() || VPI->isVectorToScalar() ||
520 return !RR->isPartialReduction();
525 return Expr->isVectorToScalar();
536 return RV == RV->getDefiningRegion()->getCanonicalIV();
541 const VPBasicBlock *VPBB = R ? R->getParent() :
nullptr;
549 AddToWorklist(R->operands());
560 if (!R->isSingleScalar() || R->getOpcode() == Instruction::Alloca ||
561 (R->mayHaveSideEffects() &&
564 AddToWorklist(R->operands());
570 AddToWorklist(R->operands());
573 .Case([](
const VPPhi *) {
586 AddToWorklist(R->operands());
604 for (
unsigned I = 0;
I != Worklist.
size(); ++
I) {
613 return RepR->doesGeneratePerAllLanes();
615 return VPI->doesGeneratePerAllLanes();
617 return SIVSteps->doesGeneratePerAllLanes();
633 return RR->getVFScaleFactor();
635 return RR->getVFScaleFactor();
637 return ER->getVFScaleFactor();
641 "getting scaling factor of reduction-start-vector not implemented yet");
651 if (R.mayHaveSideEffects() || R.mayReadFromMemory() || R.isPhi())
655 return RepR && RepR->getOpcode() == Instruction::Alloca;
662 "FirstBB and LastBB from different regions");
664 bool InSingleSuccChain =
false;
666 InSingleSuccChain |= (Succ == LastBB);
667 assert(InSingleSuccChain &&
668 "LastBB unreachable from FirstBB in single-successor chain");
672 auto *LastIt =
find(Blocks, LastBB);
673 assert(LastIt != Blocks.end() &&
674 "LastBB unreachable from FirstBB in depth-first traversal");
675 Blocks.erase(std::next(LastIt), Blocks.end());
691 if (Pred != MiddleVPBB)
705 Builder.createDerivedIV(Kind, FPBinOp, StartV, CanonicalIV, Step, Flags);
713 "BaseIV's type must be at least as large as ResultTy");
714 BaseIV = Builder.createScalarZExtOrTrunc(BaseIV, ResultTy,
DL);
719 "Step's type must be at least as large as ResultTy");
722 VPBuilder::InsertPointGuard Guard(Builder);
723 Builder.setInsertPoint(VecPreheader);
724 Step = Builder.createScalarZExtOrTrunc(Step, ResultTy,
DL);
726 return Builder.createScalarIVSteps(InductionOpcode, FPBinOp, BaseIV, Step,
751 if (
auto *R = VPBB->getParent())
752 return !R->isReplicator() && !VPBB->hasPredecessors();
769std::pair<VPBasicBlock *, VPBasicBlock *>
775 assert(Header->getNumPredecessors() == 2 &&
776 "Header must have exactly 2 predecessors");
778 return {Header, Latch};
788 return ID.getInductionBinOp()->getFastMathFlags();
799 std::optional<APInt> Step = ID.getConstStepValue();
801 Step && !Step->isMinSignedValue();
808std::optional<MemoryLocation>
815 if (
MDNode *NoAliasMD = M->getMetadata(LLVMContext::MD_noalias))
816 Loc.AATags.NoAlias = NoAliasMD;
817 if (
MDNode *AliasScopeMD = M->getMetadata(LLVMContext::MD_alias_scope))
818 Loc.AATags.Scope = AliasScopeMD;
825 assert(CanIV &&
"Expected loop region to have a canonical IV");
831 auto IsIncrementStep = [&](
VPValue *Step) ->
bool {
833 return Step == &VFxUF;
836 if (!UF.isMaterialized())
837 return Step == &UF ||
866 IsIncrementStep(Step)) {
873 "After materializing VFxUF, an increment must exist");
876 "NUW flag in region and increment must match");
900 while (!WorkList.
empty()) {
902 if (!Seen.
insert(Cur).second)
910 return Seen.contains(Blend->getIncomingValue(I));
916 if (InterleaveR->getAddr() == Cur)
925 if (MemR->getAddr() == Cur && MemR->isConsecutive())
943 if (VPI && VPI->getMask() == Cur &&
959VPValue *VPSCEVExpander::tryToReuseIRValue(
const SCEV *S) {
962 VPlan &Plan = Builder.getPlan();
964 bool ReuseNeedsDrop =
false;
965 for (
Value *V : SE.getSCEVValues(S)) {
980 if (DropPoisonGeneratingInsts.
empty())
982 ReuseNeedsDrop =
true;
990bool VPSCEVExpander::canExpandInIR(
const SCEV *S) {
991 return HoistOutOf && !SafeUDivMode && SE.isLoopInvariant(S, HoistOutOf) &&
992 SE.isGuaranteedNotToCauseUB(S);
998static std::pair<const SCEV *, const SCEV *>
1001 return {
nullptr,
nullptr};
1005 if (InvOps.
size() < 2 || VarOps.
empty())
1006 return {
nullptr,
nullptr};
1011 const SCEV *
Base = SE.getPointerBase(S);
1012 const SCEV *
Offset = SE.removePointerBase(S);
1017 if (InvS && InvS->getType()->isPointerTy() && canExpandInIR(InvS))
1018 std::tie(
Base,
Offset) = std::tie(InvS, VarS);
1022 : GEPNoWrapFlags::
none();
1025 return Builder.createNoWrapPtrAdd(BaseV, OffsetV, GEPFlags, DL);
1032 auto UseSubtract = [](
const SCEV *
Op) {
return Op->isNonConstantNegative(); };
1036 stable_sort(SCEVOps, [&](
const SCEV *L,
const SCEV *R) {
1037 return !UseSubtract(L) && UseSubtract(R);
1040 for (
const SCEV *
Op : SCEVOps) {
1042 bool Negate = !
Ops.empty() && UseSubtract(
Op);
1043 Ops.push_back(
expand(Negate ? SE.getNegativeSCEV(
Op) :
Op));
1047 if (UseSubtract(
Op)) {
1052 WrapFlags.
HasNSW && !SE.getSignedRangeMin(
Op).isMinSignedValue();
1053 Result = Builder.createOverflowingOp(Instruction::Sub, {
Result, OpV},
1054 {
false, HasNSW}, DL);
1057 Result = Builder.createOverflowingOp(Instruction::Add, {
Result, OpV},
1070 if (
VPRecipeBase *InsertPt = Builder.getRecipeAtInsertPoint())
1072 return VPDT.
dominates(R->getParent(), Builder.getInsertBlock());
1078 if (
VPValue *V = InsertedExpressions.lookup(
Key)) {
1080 "reused expansion must dominate the insert point");
1084 InsertedExpressions[
Key] = V;
1088VPValue *VPSCEVExpander::expandImpl(
const SCEV *S) {
1089 if (
VPValue *V = tryToReuseIRValue(S))
1092 if (canExpandInIR(S))
1102 return Builder.createVScale(S->
getType(),
DL);
1106 AddE->hasNoSignedWrap());
1111 return expandAsPtrAdd(AddE);
1117 if (InvS && canExpandInIR(InvS))
1118 SCEVOps = {InvS, VarS};
1119 return expandAddOps(SCEVOps, WrapFlags);
1123 VPIRFlags::WrapFlagsTy WrapFlags(MulE->hasNoUnsignedWrap(),
1124 MulE->hasNoSignedWrap());
1126 for (
const SCEV *
Op :
reverse(MulE->operands()))
1130 Result = Builder.createOverflowingOp(Instruction::Mul, {
Result, OpV},
1138 const SCEV *RHSExpr = UDiv->getRHS();
1143 Type *Ty = UDiv->getType();
1144 bool GuaranteedNotPoison =
1146 if (!GuaranteedNotPoison)
1147 RHS = Builder.createFreeze(
RHS, DL);
1148 if (!SE.isKnownNonZero(RHSExpr) || !GuaranteedNotPoison)
1149 RHS = Builder.createScalarIntrinsic(
1150 Intrinsic::umax, {
RHS, Builder.getPlan().getConstantInt(Ty, 1)}, Ty,
1153 return Builder.createNaryOp(Instruction::UDiv, {
LHS,
RHS},
1162 VPValue *
Op =
expand(Cast->getOperand());
1166 Opcode = Instruction::Trunc;
1169 Opcode = Instruction::ZExt;
1172 Opcode = Instruction::SExt;
1175 Opcode = Instruction::PtrToAddr;
1185 if (Opcode == Instruction::PtrToAddr) {
1186 VPlan &Plan = Builder.getPlan();
1191 [&](
const CastInst *CI) {
1192 return SE.DT.dominates(CI->getParent(), PH);
1199 std::optional<VPIRFlags>
Flags;
1200 if (Opcode == Instruction::ZExt)
1202 VPIRFlags::NonNegFlagsTy(SE.isKnownNonNegative(Cast->getOperand()));
1204 return Builder.createScalarCast(Opcode,
Op, S->
getType(), DL, Flags);
1215 IntrinsicID = Intrinsic::umax;
1218 IntrinsicID = Intrinsic::smax;
1222 IntrinsicID = Intrinsic::umin;
1225 IntrinsicID = Intrinsic::smin;
1235 Type *ResultTy = MinMax->getType();
1236 bool PrevSafeMode = SafeUDivMode;
1238 for (
const SCEV *SCEVOp :
reverse(MinMax->operands())) {
1239 bool MayShortCircuit =
1240 IsSequential &&
Ops.size() != MinMax->getNumOperands() - 1;
1241 SafeUDivMode = MayShortCircuit || PrevSafeMode;
1242 VPValue *OpV =
expand(SCEVOp);
1243 SafeUDivMode = PrevSafeMode;
1244 if (MayShortCircuit)
1245 OpV = Builder.createFreeze(OpV, DL);
1251 Result = Builder.createScalarIntrinsic(IntrinsicID, {
Result,
Op},
1257 VPValue *
Cmp = Builder.createICmp(
1259 Result = Builder.createSelect(Cmp, Result,
Op, DL);
1260 Function &
F = *Builder.getPlan().getIRFunction();
1269 VPlan &Plan = Builder.getPlan();
1271 assert(SE.DT.dominates(AR->getLoop()->getHeader(), PH) &&
1272 "can only expand AddRecs for loops outside VPlan's scope");
1274 Type *Ty = AR->getType();
1277 VPValue *DiffV =
expand(Diff);
1279 if (LCSSAPhi->getType()->isPointerTy()) {
1281 return Builder.createPtrAdd(BaseV, DiffV, DL);
1282 BaseV = Builder.createScalarCast(Instruction::PtrToAddr, BaseV, Ty, DL);
1284 return Builder.createAdd(BaseV, DiffV, DL);
1291 const Loop *
L = AR->getLoop();
1292 auto m_scev_CanonicalIV =
1294 if (!AR->isAffine() ||
match(AR, m_scev_CanonicalIV))
1297 const SCEV *Step = AR->getStepRecurrence(SE);
1299 if (AR->getStart()->isZero()) {
1301 SE.getAddRecExpr(SE.getZero(Ty), SE.getOne(Ty), L,
SCEV::FlagNone);
1302 return Builder.createOverflowingOp(
1304 {SE.willNotOverflow(Instruction::Mul,
false, CanIV, Step),
1305 SE.willNotOverflow(Instruction::Mul,
true, CanIV, Step)},
1311 return expandAsPtrAdd(AR);
1313 VPValue *Rest =
expand(SE.getAddRecExpr(SE.getZero(Ty), Step, L,
1315 return Builder.createAdd(Start, Rest, DL,
"",
1316 {AR->hasNoUnsignedWrap(),
false});
1328 bool IsConditionalAssume = RepR && RepR->isPredicated() &&
1330 if (IsConditionalAssume)
1333 if (R.mayHaveSideEffects())
1338 R.getVPSingleValue() == R.getParent()->getPlan()->getTripCount())
1342 return all_of(R.definedValues(), [](
VPValue *V) { return V->user_empty(); });
1350 while (!WorkList.
empty()) {
1352 if (!Seen.
insert(Cur).second)
1360 R->eraseFromParent();
1366 for (
unsigned I = 0;
I !=
Users.size(); ++
I) {
1369 Users.insert_range(V->users());
1371 return Users.takeVector();
1380 if (Num == 0 || Num == Denom)
1395static std::optional<SmallVector<BranchProbability>>
1405 return std::nullopt;
1412 assert(!Blocks.
empty() &&
"expected at least the header block");
1417 BFIBase::BlockNode Header(0), Outside(Blocks.
size());
1418 BFIBase::LoopData &
Loop = BFI.Loops.emplace_back(
nullptr, Header);
1420 for (
auto [Idx, VPBB] :
enumerate(Blocks)) {
1421 Nodes[VPBB] = BFIBase::BlockNode(Idx);
1422 BFI.Working.emplace_back(BFIBase::BlockNode(Idx)).Loop = &
Loop;
1424 BFI.Working.emplace_back(Outside);
1425 BFI.Working[Header.Index].getMass() = BFIBase::BlockMass::getFull();
1430 for (
auto [Idx, VPBB] :
enumerate(Blocks)) {
1431 BFIBase::BlockNode
Node(Idx);
1434 bool TermIsEstimated = Term && Term->hasEstimatedBranchWeights();
1435 BFIBase::Distribution Dist;
1436 for (
auto [SuccIdx, Succ] :
enumerate(VPBB->getSuccessors())) {
1437 BFIBase::BlockNode SuccNode = Nodes.
lookup_or(Succ, Outside);
1438 if (SuccNode != Header && SuccNode != Outside) {
1439 IsUnknown[SuccNode.Index] |= IsUnknown[Idx] || !Probs;
1440 IsEstimated[SuccNode.Index] |= IsEstimated[Idx] || TermIsEstimated;
1443 BFI.addToDist(Dist, &
Loop,
Node, SuccNode,
1447 BFI.distributeMass(
Node, &
Loop, Dist);
1455 for (
auto [Idx, VPBB] :
enumerate(Blocks)) {
1456 std::optional<VPExecutionFrequency> &Freq = Frequencies[VPBB];
1459 uint64_t Mass = BFI.Working[Idx].getMass().getMass();
1460 Freq.emplace(
BlockFrequency(std::max<uint64_t>(Mass, 1)), IsEstimated[Idx]);
1484 VPlan &Plan = *R.getParent()->getPlan();
1485 auto FoldToIRValue = [&]() ->
Value * {
1487 if (OpcodeOrIID->first) {
1493 return Folder.FoldIntrinsic(OpcodeOrIID->second,
Ops, R.getScalarType(),
1494 RFlags ? RFlags->getFastMathFlagsOrNone()
1497 unsigned Opcode = OpcodeOrIID->second;
1503 R.getVPSingleValue()->getScalarType());
1506 return Folder.FoldBinOp(Instruction::BinaryOps::Xor,
Ops[0],
1508 case Instruction::Select:
1509 return Folder.FoldSelect(
Ops[0],
Ops[1],
Ops[2]);
1510 case Instruction::ICmp:
1511 case Instruction::FCmp:
1514 case Instruction::GetElementPtr: {
1517 return Folder.FoldGEP(
DL,
GEP->getSourceElementType(),
Ops[0],
1527 case Instruction::ExtractElement:
1532 uint64_t Multiplier = 1;
1541 if (Multiplier != 1 &&
1556 Intrinsic::get_active_lane_mask,
Ops,
1561 if (
C->isOneValue())
1563 if (
C->isNullValue())
1571 if (
Value *V = FoldToIRValue())
1587 if (
none_of(Def.operands(), MatchPerm))
1592 return (Op->hasOneUse() && MatchPerm(Op)) || match(Op, m_LiveIn());
1597 for (
unsigned I = 0, E = Def.getNumOperands();
I != E; ++
I)
1598 if (
VPValue *
X = MatchPerm(Def.getOperand(
I)))
1599 Def.setOperand(
I,
X);
1612 assert(!Defs.
empty() &&
"Defs shouldn't be empty");
1615 "VPBB isn't reachable from entry");
1626 Type *Ty = Defs.
begin()->second->getScalarType();
1635 if (
all_equal(Phi->incoming_values())) {
1636 VPValue *Common = Phi->getIncomingValue(0);
1637 Phi->replaceAllUsesWith(Common);
1638 for (
auto &[
_, V] : Defs)
1641 Defs[VPBB] = Common;
1642 Phi->eraseFromParent();
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
iv Induction Variable Users
static constexpr Value * getValue(Ty &ValueOrUse)
const AbstractManglingParser< Derived, Alloc >::OperatorInfo AbstractManglingParser< Derived, Alloc >::Ops[]
This file provides a LoopVectorizationPlanner class.
This file provides utility analysis objects describing memory locations.
This file contains the declarations for profiling metadata utility functions.
This file implements a set that has insertion order iteration characteristics.
static SymbolRef::Type getType(const Symbol *Sym)
This file implements the TypeSwitch template, which mimics a switch() statement whose cases are type ...
This file implements dominator tree analysis for a single level of a VPlan's H-CFG.
static bool dominatesInsertPoint(const VPValue *V, const VPBuilder &Builder)
Returns true if V dominates the insert point of Builder.
static BranchProbability getBranchProbabilityKeepingPartial(uint64_t Num, uint64_t Denom)
Returns Num / Denom as a BranchProbability, clamped so a ratio that is neither zero nor one does not ...
static std::optional< SmallVector< BranchProbability > > getSuccessorProbabilities(const VPBasicBlock *VPBB)
Returns the probability of each successor edge of VPBB, computed via BranchProbabilityInfo::getEdgePr...
static std::pair< const SCEV *, const SCEV * > splitInvariantSum(const SCEVAddExpr *S, const Loop *L, ScalarEvolution &SE)
Returns the sums of the operands of S invariant in L and of the remaining operands,...
static bool isUniformAcrossVFsAndUFsImpl(const VPValue *V, function_ref< void(VPUser::const_operand_range)> AddToWorklist)
static bool preservesUniformity(unsigned Opcode)
Returns true if Opcode preserves uniformity, i.e., if all operands are uniform, the result will also ...
static bool poisonGuaranteesUB(const VPValue *V)
Returns true if V being poison is guaranteed to trigger UB because it propagates to the address of a ...
static const uint32_t IV[8]
Class for arbitrary precision integers.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
size_t size() const
Get the array size.
bool empty() const
Check if the array is empty.
LLVM Basic Block Representation.
LLVM_ABI const DataLayout & getDataLayout() const
Get the data layout of the module this basic block belongs to.
Base class for BlockFrequencyInfoImpl.
uint64_t getFrequency() const
Returns the frequency as a fixpoint number scaled by the entry frequency.
static LLVM_ABI SmallVector< BranchProbability > getEdgeProbabilitiesFromWeights(ArrayRef< uint32_t > Weights)
Returns the probabilities of edges with branch weights Weights.
static LLVM_ABI BranchProbability getBranchProbability(uint64_t Numerator, uint64_t Denominator)
static constexpr BranchProbability getOne()
static uint32_t getDenominator()
static constexpr BranchProbability getRaw(uint32_t N)
static LLVM_ABI ConstantInt * getTrue(LLVMContext &Context)
static LLVM_ABI ConstantInt * getFalse(LLVMContext &Context)
static LLVM_ABI Constant * getAllOnesValue(Type *Ty)
A parsed version of the target data layout string in and methods for querying it.
static DebugLoc getUnknown()
ValueT lookup_or(const_arg_type_t< KeyT > Val, U &&Default) const
ValueT lookup(const_arg_type_t< KeyT > Val) const
Return the entry for the specified key, or a default constructed value if no such entry exists.
bool dominates(const DomTreeNodeBase< NodeT > *A, const DomTreeNodeBase< NodeT > *B) const
dominates - Returns true iff A dominates B.
LLVM_ABI bool dominates(const BasicBlock *BB, const Use &U) const
Return true if the (end of the) basic block BB dominates the use U.
Utility class for floating point operations which can have information about relaxed accuracy require...
Convenience struct for specifying and reasoning about fast-math flags.
Represents flags for the getelementptr instruction/expression.
static GEPNoWrapFlags noUnsignedWrap()
static GEPNoWrapFlags none()
A struct for saving information about induction variables.
InductionKind
This enum represents the kinds of inductions that we support.
@ IK_FpInduction
Floating point induction variable.
@ IK_IntInduction
Integer induction variable. Step = C.
InstSimplifyFolder - Use InstructionSimplify to fold operations to existing values.
bool contains(const LoopT *L) const
Return true if the specified loop is contained within this loop.
LoopT * getLoopFor(const BlockT *BB) const
Return the inner most loop that BB lives in.
Represents a single loop in the control flow graph.
Representation for a specific memory location.
ICmpInst::Predicate getPredicate() const
Returns the comparison predicate underlying the intrinsic.
PointerIntPair - This class implements a pair of a pointer and small integer.
An interface layer with SCEV used to manage how we see SCEV expressions for values in the context of ...
ScalarEvolution * getSE() const
Returns the ScalarEvolution analysis used.
LLVM_ABI const SCEV * getPredicatedSCEV(const SCEV *Expr)
Returns the rewritten SCEV for Expr in the context of the current SCEV predicate.
This node represents an addition of some number of SCEVs.
static LLVM_ABI CastInst * findReusableCastForPtrToAddr(Value *PtrOp, Type *Ty, const DataLayout &DL, function_ref< bool(const CastInst *)> Dominates)
Find an existing cast among PtrOp's users that computes the same value as a ptrtoaddr of PtrOp to Ty ...
static LLVM_ABI std::pair< PHINode *, const SCEV * > findReusableLCSSAPhi(ScalarEvolution &SE, SCEVUseT< const SCEVAddRecExpr * > S, const BasicBlock *InsertBB)
Find a phi in the exit block of S's loop, which must dominate InsertBB, such that S can be expanded i...
This node is a base class providing common functionality for n'ary operators.
bool hasNoUnsignedWrap() const
ArrayRef< SCEVUse > operands() const
This class represents an analyzed expression in the program.
static constexpr auto FlagNSW
Type * getType() const
Return the LLVM type of this SCEV expression.
static constexpr auto FlagNone
SCEVTypes getSCEVType() const
static constexpr auto FlagNW
The main scalar evolution driver.
LLVM_ABI const SCEV * getUDivExpr(SCEVUse LHS, SCEVUse RHS)
Get a canonical unsigned division expression, or something simpler if possible.
LLVM_ABI bool isKnownNonNegative(const SCEV *S)
Test if the given expression is known to be non-negative.
LLVM_ABI const SCEV * getZeroExtendExpr(SCEVUse Op, Type *Ty, unsigned Depth=0)
LLVM_ABI const SCEV * getAbsExpr(const SCEV *Op, bool IsNSW)
LLVM_ABI const SCEV * getURemExpr(SCEVUse LHS, SCEVUse RHS)
Represents an unsigned remainder expression based on unsigned division.
LLVM_ABI const SCEV * getSMinExpr(SCEVUse LHS, SCEVUse RHS)
const SCEV * getZero(Type *Ty)
Return a SCEV for the constant 0 of a specific type.
LLVM_ABI const SCEV * getMinusSCEV(SCEVUse LHS, SCEVUse RHS, SCEVFlags Flags=SCEV::FlagNone, unsigned Depth=0)
Return LHS-RHS.
LLVM_ABI uint64_t getTypeSizeInBits(Type *Ty) const
Return the size in bits of the specified type, for which isSCEVable must return true.
LLVM_ABI const SCEV * getConstant(ConstantInt *V)
LLVM_ABI const SCEV * getSCEV(Value *V)
Return a SCEV expression for the full generality of the specified expression.
static LLVM_ABI bool isGuaranteedNotToBePoison(const SCEV *Op)
Returns true if Op is guaranteed to not be poison.
const SCEV * getOne(Type *Ty)
Return a SCEV for the constant 1 of a specific type.
LLVM_ABI SCEVUse getAddRecExpr(SCEVUse Start, SCEVUse Step, const Loop *L, SCEVFlagsPair Flags)
Get an add recurrence expression for the specified loop.
LLVM_ABI bool isLoopInvariant(const SCEV *S, const Loop *L)
Return true if the value of the given SCEV is unchanging in the specified loop.
LLVM_ABI const SCEV * getTruncateExpr(SCEVUse Op, Type *Ty, unsigned Depth=0)
LLVM_ABI SCEVUse getAddExpr(SmallVectorImpl< SCEVUse > &Ops, SCEVFlagsPair Flags={}, unsigned Depth=0)
Get a canonical add expression, or something simpler if possible.
LLVM_ABI bool isSCEVable(Type *Ty) const
Test if values of the given type are analyzable within the SCEV framework.
LLVM_ABI const SCEV * getSignExtendExpr(SCEVUse Op, Type *Ty, unsigned Depth=0)
LLVM_ABI const SCEV * getUMaxExpr(SCEVUse LHS, SCEVUse RHS)
const SCEV * getMinusOne(Type *Ty)
Return a SCEV for the constant -1 of a specific type.
LLVM_ABI const SCEV * getCouldNotCompute()
LLVM_ABI SCEVUse getMulExpr(SmallVectorImpl< SCEVUse > &Ops, SCEVFlagsPair Flags={}, unsigned Depth=0)
Get a canonical multiply expression, or something simpler if possible.
const SCEV * getPowerOfTwo(Type *Ty, unsigned Power)
Return a SCEV for the constant Power of two.
LLVM_ABI const SCEV * getPtrToAddrExpr(const SCEV *Op)
LLVM_ABI const SCEV * getSMaxExpr(SCEVUse LHS, SCEVUse RHS)
LLVM_ABI const SCEV * getTruncateOrZeroExtend(const SCEV *V, Type *Ty, unsigned Depth=0)
Return a SCEV corresponding to a conversion of the input value to the specified type.
LLVM_ABI bool canReuseInstruction(const SCEV *S, Instruction *I, SmallVectorImpl< Instruction * > &DropPoisonGeneratingInsts)
Check whether it is poison-safe to represent the expression S using the instruction I.
LLVM_ABI const SCEV * getGEPExpr(GEPOperator *GEP, ArrayRef< SCEVUse > IndexExprs)
Returns an expression for a GEP.
LLVM_ABI const SCEV * getUMinExpr(SCEVUse LHS, SCEVUse RHS, bool Sequential=false)
A vector that has set insertion semantics.
size_type size() const
Determine the number of elements in the SetVector.
void insert_range(Range &&R)
bool insert(const value_type &X)
Insert a new element into the SetVector.
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
A SetVector that performs no allocations if smaller than a certain size.
reference emplace_back(ArgTypes &&... Args)
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
This class implements a switch-like dispatch statement for a value of 'T' using dyn_cast functionalit...
TypeSwitch< T, ResultT > & Case(CallableT &&caseFn)
Add a case on the given type.
The instances of the Type class are immutable: once they are created, they are never changed.
bool isPointerTy() const
True if this is an instance of PointerType.
static LLVM_ABI IntegerType * getInt8Ty(LLVMContext &C)
Type * getScalarType() const
If this is a vector type, return the element type, otherwise return 'this'.
LLVM_ABI TypeSize getPrimitiveSizeInBits() const LLVM_READONLY
Return the basic size of this type if it is a primitive type.
static LLVM_ABI IntegerType * getInt1Ty(LLVMContext &C)
bool isIntegerTy() const
True if this is an instance of IntegerType.
VPBasicBlock serves as the leaf of the Hierarchical Control-Flow Graph.
iterator getFirstNonPhi()
Return the position of the first non-phi node recipe in the block.
VPRecipeBase * getTerminator()
If the block has multiple successors, return the branch recipe terminating the block.
VPBlockBase is the building block of the Hierarchical Control-Flow Graph.
VPRegionBlock * getParent()
iterator_range< VPBlockBase ** > predecessors()
size_t getNumSuccessors() const
size_t getNumPredecessors() const
const VPBlocksTy & getPredecessors() const
VPBlockBase * getSinglePredecessor() const
const VPBasicBlock * getEntryBasicBlock() const
VPBlockBase * getSingleHierarchicalPredecessor()
VPBlockBase * getSingleSuccessor() const
const VPBlocksTy & getSuccessors() const
static bool isLatch(const VPBlockBase *VPB, const VPDominatorTree &VPDT)
Returns true if VPB is a loop latch, using isHeader().
static VPBasicBlock * getPlainCFGMiddleBlock(const VPlan &Plan)
Returns the middle block of Plan in plain CFG form (before regions are formed).
static bool isHeader(const VPBlockBase *VPB, const VPDominatorTree &VPDT)
Returns true if VPB is a loop header, based on regions or VPDT in their absence.
static auto blocksOnly(T &&Range)
Return an iterator range over Range which only includes BlockTy blocks.
static std::pair< VPBasicBlock *, VPBasicBlock * > getPlainCFGHeaderAndLatch(const VPlan &Plan)
Returns the header and latch of the outermost loop of Plan in plain CFG form (before regions are form...
static SmallVector< VPBasicBlock * > blocksInSingleSuccessorChainBetween(VPBasicBlock *FirstBB, VPBasicBlock *LastBB)
Returns the blocks between FirstBB and LastBB, where FirstBB to LastBB forms a single-sucessor chain.
VPPhi * createScalarPhi(ArrayRef< VPValue * > IncomingValues, DebugLoc DL=DebugLoc::getUnknown(), const Twine &Name="", std::optional< VPIRFlags > Flags=std::nullopt, Type *ResultTy=nullptr)
Create a phi with IncomingValues, using the default flags for the result type, unless Flags is set.
A recipe for handling scalar conditional induction PHIs.
ArrayRef< VPRecipeValue * > definedValues()
Returns an ArrayRef of the values defined by the VPDef.
A recipe for converting Current into Start + Current * Step.
Template specialization of the standard LLVM dominator tree utility for VPBlockBases.
LLVM_ABI_FOR_TEST bool properlyDominates(const VPRecipeBase *A, const VPRecipeBase *B) const
Recipe to expand a SCEV expression.
A special type of VPBasicBlock that wraps an existing IR basic block.
Class to record and manage LLVM IR flags.
static LLVM_ABI_FOR_TEST VPIRFlags getDefaultFlags(unsigned Opcode, Type *ResultTy=nullptr)
Returns default flags for Opcode and scalar ResultTy for opcodes that support it, asserts otherwise.
This is a concrete Recipe that models a single VPlan-level instruction.
bool doesGenerateSingleScalar() const
Returns true if the recipe produces a single scalar value.
@ ReductionStartVector
Start vector for reductions with 3 operands: the original start value, the identity value for the red...
unsigned getOpcode() const
bool isVectorToScalar() const
Returns true if this VPInstruction produces a scalar value from a vector, e.g.
VPPredInstPHIRecipe is a recipe for generating the phi nodes needed when control converges back from ...
VPRecipeBase is a base class modeling a sequence of one or more output IR instructions.
DebugLoc getDebugLoc() const
Returns the debug location of the recipe.
void insertAfter(VPRecipeBase *InsertPos)
Insert an unlinked Recipe into a basic block immediately after the specified Recipe.
A recipe for handling reduction phis.
VPRegionBlock represents a collection of VPBasicBlocks and VPRegionBlocks which form a Single-Entry-S...
bool isReplicator() const
An indicator whether this region is to generate multiple replicated instances of output IR correspond...
bool hasCanonicalIVNUW() const
Indicates if NUW is set for the canonical IV increment, for loop regions.
VPRegionValue * getCanonicalIV()
Return the canonical induction variable of the region, null for replicating regions.
VPValues are defined by a VPRegionBlock, like the canonical IV.
VPReplicateRecipe replicates a given instruction producing multiple scalar copies of the original sca...
VPValue * expand(const SCEV *S)
Expand S into recipes and live-ins using the builder.
A recipe for handling phi nodes of integer and floating-point inductions, producing their scalar valu...
VPSingleDefRecipe is a base class for recipes that model a sequence of one or more output IR that def...
A symbolic live-in VPValue, used for values like vector trip count, VF, and VFxUF.
bool isMaterialized() const
Returns true if this value has been materialized.
This class augments VPValue with operands which provide the inverse def-use edges from VPValue's user...
VPValue * getOperand(unsigned N) const
iterator_range< const_operand_iterator > const_operand_range
This is the base class of the VPlan Def/Use graph, used for modeling the data flow into,...
Type * getScalarType() const
Returns the scalar type of this VPValue, dispatching based on the concrete subclass.
VPRecipeBase * getDefiningRecipe()
Returns the recipe defining this VPValue or nullptr if it is not defined by a recipe,...
Value * getUnderlyingValue() const
Return the underlying Value attached to this VPValue.
A recipe to compute a pointer to the last element of each part of a widened memory access for widened...
A recipe to compute the pointers for widened memory accesses of SourceElementTy, with the Stride expr...
VPWidenCastRecipe is a recipe to create vector cast instructions.
A recipe for handling GEP instructions.
VPValue * getStepValue()
Returns the step value of the induction.
A recipe for handling phi nodes of integer and floating-point inductions, producing their vector valu...
A recipe for widened phis.
VPWidenRecipe is a recipe for producing a widened instruction using the opcode and operands of the re...
VPlan models a candidate for vectorization, encoding various decisions take to produce efficient outp...
LLVMContext & getContext() const
VPBasicBlock * getEntry()
iterator_range< SmallSetVector< ElementCount, 2 >::iterator > vectorFactors() const
Returns an iterator range over all VFs of the plan.
VPSymbolicValue & getVFxUF()
Returns VF * UF of the vector loop region.
ArrayRef< VPIRBasicBlock * > getExitBlocks() const
Return an ArrayRef containing VPIRBasicBlocks wrapping the exit blocks of the original scalar loop.
VPIRValue * getOrAddLiveIn(Value *V)
Gets the live-in VPIRValue for V or adds a new live-in (if none exists yet) for V.
VPIRValue * getZero(Type *Ty)
Return a VPIRValue wrapping the null value of type Ty.
bool isUnrolled() const
Returns true if the VPlan already has been unrolled, i.e.
Function * getIRFunction() const
LLVM_ABI_FOR_TEST VPRegionBlock * getVectorLoopRegion()
Returns the VPRegionBlock of the vector loop.
unsigned getConcreteUF() const
Returns the concrete UF of the plan, after unrolling.
VPBasicBlock * getVectorPreheader() const
Returns the preheader of the vector loop region, if one exists, or null otherwise.
VPSymbolicValue & getUF()
Returns the UF of the vector loop region.
VPBasicBlock * getScalarPreheader() const
Return the VPBasicBlock for the preheader of the scalar loop.
VPSymbolicValue & getVF()
Returns the VF of the vector loop region.
LLVM Value Representation.
Type * getType() const
All values are typed, get the type of this value.
static LLVM_ABI VectorType * get(Type *ElementType, ElementCount EC)
This static method is the primary way to construct an VectorType.
static BlockMass getFull()
static constexpr bool isKnownLT(const FixedOrScalableQuantity &LHS, const FixedOrScalableQuantity &RHS)
An efficient, type-erasing, non-owning reference to a callable.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ BasicBlock
Various leaf nodes.
SpecificConstantMatch m_ZeroInt()
Convenience matchers for specific integer values.
BinaryOp_match< SrcTy, SpecificConstantMatch, TargetOpcode::G_XOR, true > m_Not(const SrcTy &&Src)
Matches a register not-ed by a G_XOR.
match_combine_or< Ty... > m_CombineOr(const Ty &...Ps)
Combine pattern matchers matching any of Ps patterns.
BinaryOp_match< LHS, RHS, Instruction::Add > m_Add(const LHS &L, const RHS &R)
BinaryOp_match< LHS, RHS, Instruction::URem > m_URem(const LHS &L, const RHS &R)
ap_match< APInt > m_APInt(const APInt *&Res)
Match a ConstantInt or splatted ConstantVector, binding the specified pointer to the contained APInt.
CastInst_match< OpTy, TruncInst > m_Trunc(const OpTy &Op)
Matches Trunc.
CastOperator_match< OpTy, Instruction::PtrToAddr > m_PtrToAddr(const OpTy &Op)
Matches PtrToAddr.
specific_intval< false > m_SpecificInt(const APInt &V)
Match a specific integer value or vector with all elements equal to the value.
bool match(Val *V, const Pattern &P)
specificval_ty m_Specific(const Value *V)
Match if we have a specific specified value.
auto match_fn(const Pattern &P)
A match functor that can be used as a UnaryPredicate in functional algorithms like all_of.
ThreeOps_match< Cond, LHS, RHS, Instruction::Select > m_Select(const Cond &C, const LHS &L, const RHS &R)
Matches SelectInst.
BinaryOp_match< LHS, RHS, Instruction::Mul > m_Mul(const LHS &L, const RHS &R)
auto m_VScale()
Matches a call to llvm.vscale().
CastInst_match< OpTy, ZExtInst > m_ZExt(const OpTy &Op)
Matches ZExt.
BinaryOp_match< LHS, RHS, Instruction::UDiv > m_UDiv(const LHS &L, const RHS &R)
auto m_ZExtOrTruncOrSelf(const OpTy &Op)
BinaryOp_match< LHS, RHS, Instruction::Add, true > m_c_Add(const LHS &L, const RHS &R)
Matches a Add with LHS and RHS in either order.
auto m_Intrinsic(const Ts &...Ops)
Match intrinsic calls like this: m_Intrinsic<Intrinsic::fabs>(m_Value(X))
BinaryOp_match< LHS, RHS, Instruction::SDiv > m_SDiv(const LHS &L, const RHS &R)
BinaryOp_match< LHS, RHS, Instruction::LShr > m_LShr(const LHS &L, const RHS &R)
BinaryOp_match< LHS, RHS, Instruction::Shl > m_Shl(const LHS &L, const RHS &R)
BinaryOp_match< LHS, RHS, Instruction::SRem > m_SRem(const LHS &L, const RHS &R)
CastInst_match< OpTy, SExtInst > m_SExt(const OpTy &Op)
Matches SExt.
BinaryOp_match< LHS, RHS, Instruction::Mul, true > m_c_Mul(const LHS &L, const RHS &R)
Matches a Mul with LHS and RHS in either order.
BinaryOp_match< LHS, RHS, Instruction::Sub > m_Sub(const LHS &L, const RHS &R)
auto m_ConstantInt()
Match an arbitrary ConstantInt and ignore it.
cst_pred_ty< is_one > m_scev_One()
Match an integer 1.
specificloop_ty m_SpecificLoop(const Loop *L)
cst_pred_ty< is_zero > m_scev_Zero()
Match an integer 0.
bool match(const SCEV *S, const Pattern &P)
SCEVAffineAddRec_match< Op0_t, Op1_t, match_isa< const Loop > > m_scev_AffineAddRec(const Op0_t &Op0, const Op1_t &Op1)
AllRecipe_commutative_match< Instruction::And, Op0_t, Op1_t > m_c_BinaryAnd(const Op0_t &Op0, const Op1_t &Op1)
Match a binary AND operation.
AllRecipe_match< Instruction::Or, Op0_t, Op1_t > m_BinaryOr(const Op0_t &Op0, const Op1_t &Op1)
Match a binary OR operation.
RecipeTy * findSingleUser(VPValue *V, const MatchT &P)
Return the sole user of V matching pattern P, casting it to RecipeTy, or nullptr.
AllRecipe_match< Opcode, Op0_t, Op1_t > m_Binary(const Op0_t &Op0, const Op1_t &Op1)
AllRecipe_match< Opcode, Op0_t > m_Unary(const Op0_t &Op0)
auto m_GetElementPtr(const Op0_t &Op0, const Op1_t &Op1)
auto m_VPValue()
Match an arbitrary VPValue and ignore it.
VPInstruction_match< VPInstruction::Broadcast, Op0_t > m_Broadcast(const Op0_t &Op0)
match_bind< VPInstruction > m_VPInstruction(VPInstruction *&V)
Match a VPInstruction, capturing if we match.
VPInstruction_match< VPInstruction::ExtractVectorForPart, Op_t... > m_ExtractVectorForPart(const Op_t &...Op)
void pullOutPermutationsImpl(VPlan &Plan, function_ref< VPValue *(VPValue *Op)> Perm, function_ref< VPSingleDefRecipe *(VPSingleDefRecipe *X)> Build)
Template-independent implementation for pullOutPermutations.
BranchProbability getExecutionProbability(BlockFrequency Freq)
Returns Freq as a BranchProbability, relative to the full mass.
bool isSingleScalar(const VPValue *VPV)
Returns true if VPV is a single scalar, either because it produces the same value for all lanes or on...
bool cannotHoistOrSinkRecipe(const VPRecipeBase &R, bool Sinking=false)
Return true if we do not know how to (mechanically) hoist or sink R.
unsigned getOpcode(const VPValue *V)
Return the instruction opcode for the recipe defining V or 0 for unsupported recipes and VPValues not...
std::optional< int64_t > getConstantStride(VPValue *Addr, Type *AccessTy, PredicatedScalarEvolution &PSE, const Loop *L)
If the pointer operand Addr of a memory access is an affine AddRec w.r.t.
VPBasicBlock * getFirstLoopHeader(VPlan &Plan, VPDominatorTree &VPDT)
Returns the header block of the first, top-level loop, or null if none exist.
bool isAddressSCEVForCost(const SCEV *Addr, ScalarEvolution &SE, const Loop *L)
Returns true if Addr is an address SCEV that can be passed to TTI::getAddressComputationCost,...
LLVM_ABI_FOR_TEST VPValue * reconstructSSA(VPBasicBlock *VPBB, DenseMap< VPBasicBlock *, VPValue * > &Defs)
Insert phis to reconstruct SSA for a single value starting from VPBB.
bool onlyFirstPartUsed(const VPValue *Def)
Returns true if only the first part of Def is used by all users.
Intrinsic::ID getIntrinsicID(const Ty *R)
Return the intrinsic ID underlying a call.
VPInstruction * findComputeReductionResult(VPReductionPHIRecipe *PhiR)
Find the ComputeReductionResult recipe for PhiR, looking through selects inserted for predicated redu...
VPInstruction * findCanonicalIVIncrement(VPlan &Plan)
Find the canonical IV increment of Plan's vector loop region.
std::optional< MemoryLocation > getMemoryLocation(const VPRecipeBase &R)
Return a MemoryLocation for R with noalias metadata populated from R, if the recipe is supported and ...
bool onlyFirstLaneUsed(const VPValue *Def)
Returns true if only the first lane of Def is used by all users.
VPIRValue * tryToFoldLiveIns(VPSingleDefRecipe &R, ArrayRef< VPValue * > Operands, const DataLayout &DL)
Try to fold R using InstSimplifyFolder.
SmallVector< std::pair< VPBasicBlock *, VPIRBasicBlock * > > getEarlyExits(const VPlan &Plan, const VPBlockBase *MiddleVPBB)
Returns the (early exiting block, exit block) pairs of Plan, i.e.
VPValue * findIncomingAliasMask(const VPlan &Plan)
Finds the incoming alias-mask within the vector preheader.
DenseMap< const VPBasicBlock *, std::optional< VPExecutionFrequency > > computeExecutionFrequencies(ArrayRef< VPBasicBlock * > Blocks)
Computes for each block in Blocks, which must be in reverse post-order, the frequency with which it e...
VPScalarIVStepsRecipe * createScalarIVSteps(VPlan &Plan, InductionDescriptor::InductionKind Kind, Instruction::BinaryOps InductionOpcode, FPMathOperator *FPBinOp, Type *ResultTy, VPValue *StartV, VPValue *Step, DebugLoc DL, VPBuilder &Builder, const VPIRFlags::WrapFlagsTy &Flags={})
Create a scalar-iv-steps recipe over Plan's canonical IV for an induction of Kind with InductionOpcod...
bool propagatesFirstLaneUse(const VPUser *U, const VPValue *Op)
Returns true if checking whether U uses the first lane of Op requires recursively checking Op's users...
void recursivelyDeleteDeadRecipes(VPValue *V)
Recursively delete V and any of its operands that become dead.
bool doesGeneratePerAllLanes(const VPRecipeBase *R)
Returns true if R produces scalar values for all VF lanes.
VPIRFlags getFlagsForInduction(const InductionDescriptor &ID, const VPPhi *PhiR)
Extracts and returns NoWrap flags from PhiR and fast-math flags from ID.
bool isDeadRecipe(VPRecipeBase &R)
Returns true if R is dead, i.e.
bool isElementwise(const VPValue *V)
Return true if V is elementwise, i.e. none of the lanes are permuted.
bool onlyScalarValuesOrLanesUsed(const VPValue *Def)
Returns true if only scalar values of Def are used by all users, either directly or by extracting a c...
bool onlyScalarValuesUsed(const VPValue *Def)
Returns true if only scalar values of Def are used by all users.
LLVM_ABI_FOR_TEST bool isUniformAcrossVFsAndUFs(const VPValue *V)
Checks if V is uniform across all VF lanes and UF parts.
VPValue * getOrCreateVPValueForSCEVExpr(VPlan &Plan, const SCEV *Expr, bool ExpandInIR=false)
Get or create a VPValue that corresponds to the expansion of Expr.
bool isUsedByLoadStoreAddress(const VPValue *V)
Returns true if V is used as part of the address of another load or store.
std::optional< std::pair< bool, unsigned > > getOpcodeOrIntrinsicID(const VPValue *V)
Get the instruction opcode or intrinsic ID for the recipe defining V.
VPValue * scalarizeVPWidenPointerInduction(VPWidenPointerInductionRecipe *PtrIV, VPlan &Plan, VPBuilder &Builder)
Scalarize a VPWidenPointerInductionRecipe by replacing it with a PtrAdd (IndStart,...
GEPNoWrapFlags getGEPFlagsForPtr(VPValue *Ptr)
Returns the GEP nowrap flags for Ptr, looking through pointer casts mirroring Value::stripPointerCast...
LLVM_ABI_FOR_TEST const SCEV * getSCEVExprForVPValue(const VPValue *V, PredicatedScalarEvolution &PSE, const Loop *L=nullptr)
Return the SCEV expression for V.
unsigned getVFScaleFactor(VPRecipeBase *R)
Get the VF scaling factor applied to the recipe's output, if the recipe has one.
SmallVector< VPUser * > collectUsersRecursively(VPValue *V)
Collect all users of V, looking through recipes that define other values.
This is an optimization pass for GlobalISel generic memory operations.
auto drop_begin(T &&RangeOrContainer, size_t N=1)
Return a range covering RangeOrContainer with the first N elements excluded.
constexpr auto not_equal_to(T &&Arg)
Functor variant of std::not_equal_to that can be used as a UnaryPredicate in functional algorithms li...
void stable_sort(R &&Range)
auto find(R &&Range, const T &Val)
Provide wrappers to std::find which take ranges instead of having to pass begin/end explicitly.
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly.
uint32_t getWeightFromBranchProb(const BranchProbability Prob)
detail::zippy< detail::zip_first, T, U, Args... > zip_equal(T &&t, U &&u, Args &&...args)
zip iterator that assumes that all iteratees have the same length.
auto enumerate(FirstRange &&First, RestRanges &&...Rest)
Given two or more input ranges, returns a new range whose values are tuples (A, B,...
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
VPBuilderBase<> VPBuilder
constexpr from_range_t from_range
auto dyn_cast_if_present(const Y &Val)
dyn_cast_if_present<X> - Functionally identical to dyn_cast, except that a null (or none in the case ...
void append_range(Container &C, Range &&R)
Wrapper function to append range R to container C.
iterator_range< early_inc_iterator_impl< detail::IterOfRange< RangeT > > > make_early_inc_range(RangeT &&Range)
Make a range that does early increment to allow mutation of the underlying range without disrupting i...
iterator_range< df_iterator< VPBlockShallowTraversalWrapper< VPBlockBase * > > > vp_depth_first_shallow(VPBlockBase *G)
Returns an iterator range to traverse the graph starting at G in depth-first order.
iterator_range< df_iterator< VPBlockDeepTraversalWrapper< VPBlockBase * > > > vp_depth_first_deep(VPBlockBase *G)
Returns an iterator range to traverse the graph starting at G in depth-first order while traversing t...
constexpr auto equal_to(T &&Arg)
Functor variant of std::equal_to that can be used as a UnaryPredicate in functional algorithms like a...
auto make_isa_range(RangeT &&Range)
Return a range over Range containing only elements for which isa<T> holds, casting each of them to T.
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
unsigned Log2_32(uint32_t Value)
Return the floor log base 2 of the specified value, -1 if the value is zero.
auto reverse(ContainerTy &&C)
constexpr bool isPowerOf2_32(uint32_t Value)
Return true if the argument is a power of two > 0.
bool hasIrregularType(Type *Ty, const DataLayout &DL)
A helper function that returns true if the given type is irregular.
bool none_of(R &&Range, UnaryPredicate P)
Provide wrappers to std::none_of which take ranges instead of having to pass begin/end explicitly.
SmallVector< ValueTypeFromRangeType< R >, Size > to_vector(R &&Range)
Given a range of type R, iterate the entire range and return a SmallVector with elements of the vecto...
class LLVM_GSL_OWNER SmallVector
Forward declaration of SmallVector so that calculateSmallVectorDefaultInlinedElements can reference s...
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
LLVM_ABI MDNode * getExplicitlyUnknownBranchWeightsIfProfiled(Function &F, StringRef PassName)
Returns a metadata node containing unknown branch weights if the function has an entry count,...
LLVM_ATTRIBUTE_VISIBILITY_DEFAULT AnalysisKey InnerAnalysisManagerProxy< AnalysisManagerT, IRUnitT, ExtraArgTs... >::Key
DWARFExpression::Operation Op
auto max_element(R &&Range)
Provide wrappers to std::max_element which take ranges instead of having to pass begin/end explicitly...
ArrayRef(const T &OneElt) -> ArrayRef< T >
LLVM_ABI bool extractBranchWeights(const MDNode *ProfileData, SmallVectorImpl< uint32_t > &Weights)
Extract branch weights from MD_prof metadata.
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
auto find_if(R &&Range, UnaryPredicate P)
Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly.
constexpr auto seq(T Begin, T End)
Iterate over an integral type from Begin up to - but not including - End.
bool is_contained(R &&Range, const E &Element)
Returns true if Element is found in Range.
bool all_equal(std::initializer_list< T > Values)
Returns true if all Values in the initializer lists are equal or the list.
LLVM_ABI std::optional< int64_t > getStrideFromAddRec(const SCEVAddRecExpr *AR, const Loop *Lp, Type *AccessTy, Value *Ptr, PredicatedScalarEvolution &PSE)
If AR is an affine AddRec for Lp with a constant step, return the step in units of AccessTy's allocat...
@ Increment
Incrementally increasing token ID.
constexpr detail::IsaCheckPredicate< Types... > IsaPred
Function object wrapper for the llvm::isa type check.
SCEVUseT< const SCEV * > SCEVUse
A VPValue representing a live-in from the input IR or a constant.
A recipe for widening load operations with vector-predication intrinsics, using the address to load f...
A recipe for widening load operations, using the address to load from and an optional mask.