30#define DEBUG_TYPE "loop-vectorize"
38 dbgs() <<
"LV: " << Prefix << DebugMsg;
59 if (
I &&
I->getDebugLoc())
60 DL =
I->getDebugLoc();
72 <<
"loop not vectorized: " << OREMsg);
87 "Vectorizing: ", TheLoop->
isInnermost() ?
"innermost loop" :
"outer loop",
93 <<
"vectorized " << LoopType <<
"loop (vectorization width: "
94 <<
ore::NV(
"VectorizationFactor", VFWidth)
95 <<
", interleaved count: " <<
ore::NV(
"InterleaveCount", IC) <<
")";
102 return Opts.force_target_supports_masked_memory_ops ||
103 (IsLoad ? TTI.isLegalMaskedLoad(ScalarTy, Alignment,
AddressSpace)
104 : TTI.isLegalMaskedStore(ScalarTy, Alignment,
AddressSpace));
111 return Opts.force_target_supports_gather_scatter_ops ||
112 (IsLoad ? TTI.isLegalMaskedGather(VectorTy, Alignment)
113 : TTI.isLegalMaskedScatter(VectorTy, Alignment));
117 return TTI.supportsScalableVectors() ||
118 Opts.force_target_supports_scalable_vectors ||
122bool VFSelectionContext::useMaxBandwidth(
bool IsScalable)
const {
126 return valueOr(Opts.vectorizer_maximize_bandwidth,
127 TTI.shouldMaximizeVectorBandwidth(RegKind) ||
128 (Opts.vectorizer_maximize_bandwidth_for_vector_calls &&
138 if (TTI.shouldConsiderVectorizationRegPressure())
145 VF, VF.
isScalable() ? MaxPermissibleVFWithoutMaxBW.ScalableVF
146 : MaxPermissibleVFWithoutMaxBW.FixedVF);
150 ElementCount VF,
unsigned MaxTripCount,
unsigned UserIC,
151 bool FoldTailByMasking,
bool RequiresScalarEpilogue)
const {
153 if (VF.
isScalable() &&
F.hasFnAttribute(Attribute::VScaleRange)) {
154 auto Attr =
F.getFnAttribute(Attribute::VScaleRange);
155 auto Min = Attr.getVScaleRangeMin();
162 if (MaxTripCount > 0 && RequiresScalarEpilogue)
167 unsigned IC = UserIC > 0 ? UserIC : 1;
168 unsigned EstimatedVFTimesIC = EstimatedVF * IC;
170 if (MaxTripCount && MaxTripCount <= EstimatedVFTimesIC &&
178 if (ClampedUpperTripCount == 0)
179 ClampedUpperTripCount = 1;
180 LLVM_DEBUG(
dbgs() <<
"LV: Clamping the MaxVF to maximum power of two not "
181 "exceeding the constant trip count"
182 << (UserIC > 0 ?
" divided by UserIC" :
"") <<
": "
183 << ClampedUpperTripCount <<
"\n");
190ElementCount VFSelectionContext::getMaximizedVFForTarget(
191 unsigned MaxTripCount,
unsigned SmallestType,
unsigned WidestType,
192 ElementCount MaxSafeVF,
unsigned UserIC,
bool FoldTailByMasking,
193 bool RequiresScalarEpilogue) {
194 bool ComputeScalableMaxVF = MaxSafeVF.
isScalable();
195 const TypeSize WidestRegister = TTI.getRegisterBitWidth(
200 auto MinVF = [](
const ElementCount &
LHS,
const ElementCount &
RHS) {
202 "Scalable flags must match");
210 ComputeScalableMaxVF);
211 MaxVectorElementCount = MinVF(MaxVectorElementCount, MaxSafeVF);
213 << (MaxVectorElementCount * WidestType) <<
" bits.\n");
215 if (!MaxVectorElementCount) {
217 << (ComputeScalableMaxVF ?
"scalable" :
"fixed")
218 <<
" vector registers.\n");
223 clampVFByMaxTripCount(MaxVectorElementCount, MaxTripCount, UserIC,
224 FoldTailByMasking, RequiresScalarEpilogue);
227 if (MaxVF != MaxVectorElementCount)
231 MaxPermissibleVFWithoutMaxBW.ScalableVF = MaxVF;
233 MaxPermissibleVFWithoutMaxBW.FixedVF = MaxVF;
235 if (useMaxBandwidth(ComputeScalableMaxVF)) {
238 ComputeScalableMaxVF);
239 MaxVF = MinVF(MaxVectorElementCountMaxBW, MaxSafeVF);
241 if (ElementCount MinVF =
242 TTI.getMinimumVF(SmallestType, ComputeScalableMaxVF)) {
245 <<
") with target's minimum: " << MinVF <<
'\n');
250 MaxVF = clampVFByMaxTripCount(MaxVF, MaxTripCount, UserIC,
251 FoldTailByMasking, RequiresScalarEpilogue);
257 if (
F.hasFnAttribute(Attribute::VScaleRange))
258 return F.getFnAttribute(Attribute::VScaleRange).getVScaleRangeMax();
263std::optional<uint64_t>
266 return EC.getFixedValue();
269 return uint64_t(EC.getKnownMinValue()) * *MaxVScale;
274bool VFSelectionContext::isScalableVectorizationAllowed() {
275 if (IsScalableVectorizationAllowed)
276 return *IsScalableVectorizationAllowed;
278 IsScalableVectorizationAllowed =
false;
284 "ScalableVectorizationDisabled", ORE, TheLoop);
288 LLVM_DEBUG(
dbgs() <<
"LV: Scalable vectorization is available\n");
291 std::numeric_limits<ElementCount::ScalarTy>::max());
300 if (!
all_of(Legal->getReductionVars(), [&](
const auto &
Reduction) ->
bool {
301 return TTI.isLegalToVectorizeReduction(Reduction.second, MaxScalableVF);
304 "Scalable vectorization not supported for the reduction "
305 "operations found in this loop.",
306 "ScalableVFUnfeasible", ORE, TheLoop);
312 if (
any_of(ElementTypesInLoop, [&](
Type *Ty) {
313 return !Ty->
isVoidTy() && !TTI.isElementTypeLegalForScalableVector(Ty);
316 "for all element types found in this loop.",
317 "ScalableVFUnfeasible", ORE, TheLoop);
321 if (!Legal->isSafeForAnyVectorWidth() && !
getMaxVScale(F)) {
323 "for safe distance analysis.",
324 "ScalableVFUnfeasible", ORE, TheLoop);
328 IsScalableVectorizationAllowed =
true;
333VFSelectionContext::getMaxLegalScalableVF(
unsigned MaxSafeElements) {
334 if (!isScalableVectorizationAllowed())
338 std::numeric_limits<ElementCount::ScalarTy>::max());
339 if (Legal->isSafeForAnyVectorWidth())
340 return MaxScalableVF;
348 "Max legal vector width too small, scalable vectorization "
350 "ScalableVFUnfeasible", ORE, TheLoop);
352 return MaxScalableVF;
356 unsigned MaxTripCount,
ElementCount UserVF,
unsigned UserIC,
357 bool FoldTailByMasking,
bool RequiresScalarEpilogue) {
364 unsigned MaxSafeElementsPowerOf2 =
366 if (!Legal->isSafeForAnyStoreLoadForwardDistances()) {
367 unsigned SLDist = Legal->getMaxStoreLoadForwardSafeDistanceInBits();
368 MaxSafeElementsPowerOf2 =
369 std::min(MaxSafeElementsPowerOf2, SLDist / WidestType);
373 auto MaxSafeScalableVF = getMaxLegalScalableVF(MaxSafeElementsPowerOf2);
375 if (!Legal->isSafeForAnyVectorWidth())
376 MaxSafeElements = MaxSafeElementsPowerOf2;
378 LLVM_DEBUG(
dbgs() <<
"LV: The max safe fixed VF is: " << MaxSafeFixedVF
380 LLVM_DEBUG(
dbgs() <<
"LV: The max safe scalable VF is: " << MaxSafeScalableVF
386 UserVF.
isScalable() ? MaxSafeScalableVF : MaxSafeFixedVF;
403 <<
" is unsafe, clamping to max safe VF="
404 << MaxSafeFixedVF <<
".\n");
407 TheLoop->getStartLoc(),
408 TheLoop->getHeader())
409 <<
"User-specified vectorization factor "
410 <<
ore::NV(
"UserVectorizationFactor", UserVF)
411 <<
" is unsafe, clamping to maximum safe vectorization factor "
412 <<
ore::NV(
"VectorizationFactor", MaxSafeFixedVF);
414 return MaxSafeFixedVF;
419 <<
" is ignored because scalable vectors are not "
423 TheLoop->getStartLoc(),
424 TheLoop->getHeader())
425 <<
"User-specified vectorization factor "
426 <<
ore::NV(
"UserVectorizationFactor", UserVF)
427 <<
" is ignored because the target does not support scalable "
428 "vectors. The compiler will pick a more suitable value.";
432 <<
" is unsafe. Ignoring scalable UserVF.\n");
435 TheLoop->getStartLoc(),
436 TheLoop->getHeader())
437 <<
"User-specified vectorization factor "
438 <<
ore::NV(
"UserVectorizationFactor", UserVF)
439 <<
" is unsafe. Ignoring the hint to let the compiler pick a "
440 "more suitable value.";
445 LLVM_DEBUG(
dbgs() <<
"LV: The Smallest and Widest types: " << SmallestType
446 <<
" / " << WidestType <<
" bits.\n");
450 if (
auto MaxVF = getMaximizedVFForTarget(
451 MaxTripCount, SmallestType, WidestType, MaxSafeFixedVF, UserIC,
452 FoldTailByMasking, RequiresScalarEpilogue))
453 Result.FixedVF = MaxVF;
455 if (
auto MaxVF = getMaximizedVFForTarget(
456 MaxTripCount, SmallestType, WidestType, MaxSafeScalableVF, UserIC,
457 FoldTailByMasking, RequiresScalarEpilogue))
459 Result.ScalableVF = MaxVF;
467std::pair<unsigned, unsigned>
469 unsigned MinWidth = -1U;
470 unsigned MaxWidth = 8;
475 if (ElementTypesInLoop.empty()) {
477 Legal->getReductionVars().values()) {
482 std::min(RdxDesc.getMinWidthCastToRecurrenceTypeInBits(),
483 RdxDesc.getRecurrenceType()->getScalarSizeInBits()));
484 MaxWidth = std::max(MaxWidth,
485 RdxDesc.getRecurrenceType()->getScalarSizeInBits());
488 for (
Type *
T : ElementTypesInLoop) {
489 MinWidth = std::min<unsigned>(
490 MinWidth,
DL.getTypeSizeInBits(
T->getScalarType()).getFixedValue());
491 MaxWidth = std::max<unsigned>(
492 MaxWidth,
DL.getTypeSizeInBits(
T->getScalarType()).getFixedValue());
504 return {MinWidth, MaxWidth};
509 ElementTypesInLoop.clear();
517 if (ValuesToIgnore && ValuesToIgnore->
contains(&
I))
527 if (!Legal->isReductionVariable(PN))
530 Legal->getRecurrenceDescriptor(PN);
540 T = ST->getValueOperand()->getType();
543 "Expected the load/store/recurrence type to be sized");
545 ElementTypesInLoop.insert(
T);
550void VFSelectionContext::initializeVScaleForTuning() {
554 if (
F.hasFnAttribute(Attribute::VScaleRange)) {
555 auto Attr =
F.getFnAttribute(Attribute::VScaleRange);
556 auto Min = Attr.getVScaleRangeMin();
557 auto Max = Attr.getVScaleRangeMax();
558 if (Max && Min == Max) {
559 VScaleForTuning = Max;
564 VScaleForTuning = TTI.getVScaleForTuning();
569 return !Hints->allowReordering() && RdxDesc.
isOrdered();
575 Loop *L =
const_cast<Loop *
>(TheLoop);
576 if (Legal->getRuntimePointerChecking()->Need) {
578 "Runtime ptr check is required with -Os/-Oz",
579 "runtime pointer checks needed. Enable vectorization of this "
580 "loop with '#pragma clang loop vectorize(enable)' when "
581 "compiling with -Os/-Oz",
582 "CantVersionLoopWithOptForSize", ORE, L);
586 if (!PSE.getPredicate().isAlwaysTrue()) {
588 "Runtime SCEV check is required with -Os/-Oz",
589 "runtime SCEV checks needed. Enable vectorization of this "
590 "loop with '#pragma clang loop vectorize(enable)' when "
591 "compiling with -Os/-Oz",
592 "CantVersionLoopWithOptForSize", ORE, L);
597 if (!Legal->getLAI()->getSymbolicStrides().empty()) {
599 "Runtime stride check for small trip count",
600 "runtime stride == 1 checks needed. Enable vectorization of "
601 "this loop without such check by compiling with -Os/-Oz",
602 "CantVersionLoopWithOptForSize", ORE, L);
615 if (!InLoopReductions.empty())
618 for (
const auto &Reduction : Legal->getReductionVars()) {
619 PHINode *Phi = Reduction.first;
641 !TTI.preferInLoopReduction(Kind, Phi->getType()))
649 bool InLoop = !ReductionOperations.
empty();
652 InLoopReductions.insert(Phi);
653 LLVM_DEBUG(
dbgs() <<
"LV: Using " << (InLoop ?
"inloop" :
"out of loop")
654 <<
" reduction for phi: " << *Phi <<
"\n");
660 const unsigned MaxTripCount,
662 bool IsEpilogue)
const {
668 if (
A.Width.isScalable() && CostA.
isValid() && !
B.Width.isScalable() &&
677 if (IsEpilogue &&
A.Width.isScalable() !=
B.Width.isScalable() &&
678 A.Cost.isValid() &&
B.Cost.isValid()) {
679 auto [FixedCost, ScalableCost] = std::make_pair(CostA, CostB);
680 if (
B.Width.isFixed())
683 ScalableCost *= Opts.scalable_epilogue_vf_cost_scale_factor;
685 if (FixedCost <= ScalableCost)
686 return A.Width.isFixed();
690 unsigned EstimatedWidthA =
A.Width.getKnownMinValue();
691 unsigned EstimatedWidthB =
B.Width.getKnownMinValue();
693 if (
A.Width.isScalable())
694 EstimatedWidthA *= *VScale;
695 if (
B.Width.isScalable())
696 EstimatedWidthB *= *VScale;
703 return CostA < CostB ||
704 (CostA == CostB && EstimatedWidthA > EstimatedWidthB);
709 bool PreferScalable = !TTI.preferFixedOverScalableIfEqualCost() &&
710 A.Width.isScalable() && !
B.Width.isScalable();
720 bool LowerCostWithoutTC =
721 CmpFn(CostA * EstimatedWidthB, CostB * EstimatedWidthA);
723 return LowerCostWithoutTC;
725 auto GetCostForTC = [MaxTripCount, HasTail](
unsigned VF,
737 return VectorCost * (MaxTripCount / VF) +
738 ScalarCost * (MaxTripCount % VF);
739 return VectorCost *
divideCeil(MaxTripCount, VF);
742 auto RTCostA = GetCostForTC(EstimatedWidthA, CostA,
A.ScalarCost);
743 auto RTCostB = GetCostForTC(EstimatedWidthB, CostB,
B.ScalarCost);
744 bool LowerCostWithTC = CmpFn(RTCostA, RTCostB);
745 LLVM_DEBUG(
if (LowerCostWithTC != LowerCostWithoutTC) {
746 dbgs() <<
"LV: VF " << (LowerCostWithTC ?
A.Width :
B.Width)
747 <<
" has lower cost than VF "
748 << (LowerCostWithTC ?
B.Width :
A.Width)
749 <<
" when taking the cost of the remaining scalar loop iterations "
750 "into consideration for a maximum trip count of "
751 << MaxTripCount <<
".\n";
753 return LowerCostWithTC;
759 bool IsEpilogue)
const {
760 const unsigned MaxTripCount = PSE.getSmallConstantMaxTripCount();
761 return LoopVectorizationPlanner::isMoreProfitable(
A,
B, MaxTripCount, HasTail,
774 "Scalable vectorization requested but not supported by the target",
775 "the scalable user-specified vectorization width for outer-loop "
776 "vectorization cannot be used because the target does not support "
778 "ScalableVFUnfeasible", ORE, TheLoop);
786 auto RegKind = TTI.enableScalableVectorization()
793 unsigned N = std::max<uint64_t>(
799 if (Opts.vplan_build_outerloop_stress_test && VF.
isScalar()) {
801 <<
"overriding computed VF.\n");
806 "VF needs to be a power of two");
810 <<
"VF " << VF <<
" to build VPlans.\n");
820 switch (R.getVPRecipeID()) {
821 case VPRecipeBase::VPFirstOrderRecurrencePHISC:
824 case VPRecipeBase::VPWidenIntOrFpInductionSC:
825 return !cast<VPWidenIntOrFpInductionRecipe>(&R)->getPHINode();
826 case VPRecipeBase::VPReductionPHISC: {
827 auto *RedPhi = cast<VPReductionPHIRecipe>(&R);
830 RecurKind Kind = RedPhi->getRecurrenceKind();
831 if (RecurrenceDescriptor::isFPMinMaxNumRecurrenceKind(Kind) ||
832 RecurrenceDescriptor::isFindLastRecurrenceKind(Kind) ||
833 !RedPhi->getUnderlyingValue())
840 if (RecurrenceDescriptor::isFindIVRecurrenceKind(Kind))
841 return RedPhi->isExpressionSunk();
850bool LoopVectorizationPlanner::isCandidateForEpilogueVectorization(
851 VPlan &MainPlan)
const {
861 if (OrigLoop->getExitingBlock() != OrigLoop->getLoopLatch() ||
862 Legal->hasUncountableEarlyExit())
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
loop Loop Strength Reduction
This file defines the LoopVectorizationLegality class.
static bool hasUnsupportedHeaderPhiRecipe(VPlan &Plan)
static void debugVectorizationMessage(const StringRef Prefix, const StringRef DebugMsg, Instruction *I)
Write a DebugMsg about vectorization to the debug output stream.
static OptimizationRemarkAnalysis createLVAnalysis(StringRef RemarkName, const Loop *TheLoop, Instruction *I, DebugLoc DL={})
Create an analysis remark that explains why vectorization failed RemarkName is the identifier for the...
This file provides a LoopVectorizationPlanner class.
LLVM Basic Block Representation.
A parsed version of the target data layout string in and methods for querying it.
static constexpr ElementCount getScalable(ScalarTy MinVal)
static constexpr ElementCount getFixed(ScalarTy MinVal)
static constexpr ElementCount get(ScalarTy MinVal, bool Scalable)
constexpr bool isScalar() const
Exactly one element.
bool isInnermost() const
Return true if the loop does not contain any (natural) loops.
BlockT * getHeader() const
bool hasVectorCallVariants() const
Returns true if there is at least one function call in the loop which has a vectorized variant availa...
bool isScalableVectorizationDisabled() const
bool isScalableVectorizationAlwaysPreferred() const
Represents a single loop in the control flow graph.
DebugLoc getStartLoc() const
Return the debug location of the start of this loop.
The RecurrenceDescriptor is used to identify recurrences variables in a loop.
Type * getRecurrenceType() const
Returns the type of the recurrence.
bool hasUsesOutsideReductionChain() const
Returns true if the reduction PHI has any uses outside the reduction chain.
static bool isFindLastRecurrenceKind(RecurKind Kind)
Returns true if the recurrence kind is of the form select(cmp(),x,y) where one of (x,...
LLVM_ABI SmallVector< Instruction *, 4 > getReductionOpChain(PHINode *Phi, Loop *L) const
Attempts to find a chain of operations from Phi to LoopExitInst that can be treated as a set of reduc...
static bool isAnyOfRecurrenceKind(RecurKind Kind)
Returns true if the recurrence kind is of the form select(cmp(),x,y) where one of (x,...
RecurKind getRecurrenceKind() const
bool isOrdered() const
Expose an ordered FP reduction to the instance users.
static bool isFindIVRecurrenceKind(RecurKind Kind)
Returns true if the recurrence kind is of the form select(cmp(),x,y) where one of (x,...
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
bool contains(ConstPtrType Ptr) const
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Represent a constant reference to a string, i.e.
The instances of the Type class are immutable: once they are created, they are never changed.
bool isVoidTy() const
Return true if this is 'void'.
FixedScalableVFPair computeVPlanOuterloopVF(ElementCount UserVF)
Returns a scalable VF to use for outer-loop vectorization if the target supports it and a fixed VF ot...
std::pair< unsigned, unsigned > getSmallestAndWidestTypes() const
bool supportsScalableVectors() const
bool runtimeChecksRequired()
Check whether vectorization would require runtime checks.
bool isLegalGatherOrScatter(bool IsLoad, Type *ScalarTy, Align Alignment, ElementCount VF) const
Returns true if the target machine supports a gather (if IsLoad) or scatter of scalar type ScalarTy w...
bool isLegalMaskedLoadOrStore(bool IsLoad, Type *ScalarTy, Align Alignment, unsigned AddressSpace) const
Returns true if the target machine supports a masked load (if IsLoad) or masked store of scalar type ...
void collectInLoopReductions()
Split reductions into those that happen in the loop, and those that happen outside.
FixedScalableVFPair computeFeasibleMaxVF(unsigned MaxTripCount, ElementCount UserVF, unsigned UserIC, bool FoldTailByMasking, bool RequiresScalarEpilogue)
const LoopVectorizeHints & getHints() const
bool useOrderedReductions(const RecurrenceDescriptor &RdxDesc) const
Returns true if we should use strict in-order reductions for the given RdxDesc.
bool shouldConsiderRegPressureForVF(ElementCount VF) const
void collectElementTypesForWidening(const SmallPtrSetImpl< const Value * > *ValuesToIgnore=nullptr)
Collect element types in the loop that need widening.
std::optional< unsigned > getVScaleForTuning() const
void computeMinimalBitwidths()
Compute smallest bitwidth each instruction can be represented with.
iterator_range< iterator > phis()
Returns an iterator range over the PHI-like recipes in the block.
const VPBasicBlock * getEntryBasicBlock() const
VPRecipeBase is a base class modeling a sequence of one or more output IR instructions.
VPlan models a candidate for vectorization, encoding various decisions take to produce efficient outp...
LLVM_ABI_FOR_TEST VPRegionBlock * getVectorLoopRegion()
Returns the VPRegionBlock of the vector loop.
static constexpr bool isKnownLE(const FixedOrScalableQuantity &LHS, const FixedOrScalableQuantity &RHS)
static constexpr bool isKnownLT(const FixedOrScalableQuantity &LHS, const FixedOrScalableQuantity &RHS)
constexpr bool isScalable() const
Returns whether the quantity is scaled by a runtime quantity (vscale).
constexpr ScalarTy getKnownMinValue() const
Returns the minimum value this quantity can represent.
constexpr bool isZero() const
static constexpr bool isKnownGT(const FixedOrScalableQuantity &LHS, const FixedOrScalableQuantity &RHS)
void reportVectorizationFailure(const StringRef DebugMsg, const StringRef OREMsg, const StringRef ORETag, OptimizationRemarkEmitter *ORE, const Loop *TheLoop, Instruction *I=nullptr)
Reports a vectorization failure: print DebugMsg for debugging purposes along with the corresponding o...
void reportVectorizationInfo(const StringRef Msg, const StringRef ORETag, OptimizationRemarkEmitter *ORE, const Loop *TheLoop, Instruction *I=nullptr, DebugLoc DL={})
Reports an informative message: print Msg for debugging purposes as well as an optimization remark.
void reportVectorization(OptimizationRemarkEmitter *ORE, Loop *TheLoop, ElementCount VFWidth, unsigned IC)
Report successful vectorization of the loop.
DiagnosticInfoOptimizationBase::Argument NV
This is an optimization pass for GlobalISel generic memory operations.
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
std::optional< uint64_t > getMaxRuntimeElementCount(ElementCount EC, const Function &F)
constexpr bool isPowerOf2_32(uint32_t Value)
Return true if the argument is a power of two > 0.
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
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...
constexpr T divideCeil(U Numerator, V Denominator)
Returns the integer ceil(Numerator / Denominator).
RecurKind
These are the kinds of recurrences that we support.
std::optional< unsigned > getMaxVScale(const Function &F)
constexpr bool valueOr(BoolOrDefault X, bool Default)
T bit_floor(T Value)
Returns the largest integral power of two no greater than Value if Value is nonzero.
Type * toVectorTy(Type *Scalar, ElementCount EC)
A helper function for converting Scalar types to vector types.
LLVM_ABI MapVector< Instruction *, uint64_t > computeMinimumValueSizes(ArrayRef< BasicBlock * > Blocks, DemandedBits &DB, const TargetTransformInfo *TTI=nullptr)
Compute a map of integer instructions to their minimum legal type size.
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
This struct is a compact representation of a valid (non-zero power of two) alignment.
A class that represents two vectorization factors (initialized with 0 by default).
static FixedScalableVFPair getNone()
TODO: The following VectorizationFactor was pulled out of LoopVectorizationCostModel class.
static LLVM_ABI ElementCount VectorizationFactor
VF as overridden by the user.