52 return TTI.getShuffleCost(Kind, DstTy, Tp, CostKind, Mask, Index, SubTp,
57 Mask, NumSrcElts, NumSubElts, Index)) {
58 if (Index + NumSubElts > NumSrcElts &&
59 Index + NumSrcElts <=
static_cast<int>(Mask.size()))
63 return TTI.getShuffleCost(Kind, DstTy, Tp, CostKind, Mask, Index, SubTp, Args,
67std::pair<InstructionCost, InstructionCost>
78 if (Opcode == Instruction::Load || Opcode == Instruction::Store) {
87 ScalarCost =
TTI.getPointersChainCost(
88 Ptrs, BasePtr, TTI::PointersChainInfo::getUnitStride(), ScalarTy,
92 for (
Value *V : Ptrs) {
102 if (!Ptr || !Ptr->hasOneUse())
106 if (PtrsRetainedInVecCode.
size() == Ptrs.size()) {
111 VecCost =
TTI.getPointersChainCost(PtrsRetainedInVecCode, BasePtr,
112 TTI::PointersChainInfo::getKnownStride(),
124 return Ptr && !Ptr->hasAllConstantIndices();
126 ? TTI::PointersChainInfo::getUnknownStride()
127 : TTI::PointersChainInfo::getKnownStride();
129 const bool IsSameBase =
136 Type *AccessTy = ScalarTy;
139 return Ptr && Ptr->hasOneUse() &&
isa<LoadInst>(Ptr->user_back());
142 AccessTy = Ptrs.
front()->user_back()->getType();
145 TTI.getPointersChainCost(Ptrs, BasePtr, PtrsInfo, AccessTy, CostKind);
149 if (It != Ptrs.
end())
156 Type *IdxTy =
DL.getIndexType(VecTy);
157 VecCost =
TTI.getArithmeticInstrCost(Instruction::Add, IdxTy, CostKind);
158 uint64_t Stride =
DL.getTypeAllocSize(BaseGEP->getSourceElementType())
163 VecCost +=
TTI.getArithmeticInstrCost(
164 isPowerOf2_64(Stride) ? Instruction::Shl : Instruction::Mul, IdxTy,
166 }
else if (BaseGEP) {
168 VecCost =
TTI.getGEPCost(BaseGEP->getSourceElementType(),
169 BaseGEP->getPointerOperand(), Indices, CostKind,
174 return std::make_pair(ScalarCost, VecCost);
181 return 2 *
TTI.getMemIntrinsicInstrCost(
185 TTI.getArithmeticInstrCost(Instruction::Xor, CmpTy, CostKind) +
186 TTI.getCmpSelInstrCost(Instruction::Select, VecTy, CmpTy,
197 return TTI.getCastInstrCost(Instruction::BitCast, DstTy, SrcTy, CCH,
202 Type *IntVecTy =
DL.getIntPtrType(DstTy);
203 return TTI.getCastInstrCost(Instruction::IntToPtr, DstTy, IntVecTy, CCH,
205 TTI.getCastInstrCost(Instruction::BitCast, IntVecTy, SrcTy, CCH,
208 Type *IntVecTy =
DL.getIntPtrType(SrcTy);
209 return TTI.getCastInstrCost(Instruction::PtrToInt, IntVecTy, SrcTy, CCH,
211 TTI.getCastInstrCost(Instruction::BitCast, DstTy, IntVecTy, CCH,
216 unsigned Opcode,
Type *ScalarTy,
231 {PaddedVecTy, PaddedVecTy, MaskTy});
233 if (!MaskedCost.isValid() || MaskedCost >= DirectCost)
236 *PaddedTy = PaddedVecTy;
243 const APInt &DemandedElts,
bool Insert,
bool Extract,
247 "ScalableVectorType is not supported.");
252 assert(ReVec &&
"Only supported by REVEC.");
255 unsigned ScalarTyNumElements = VecTy->getNumElements();
258 if (!DemandedElts[
I])
262 I * ScalarTyNumElements, VecTy);
265 I * ScalarTyNumElements, VecTy);
269 return TTI.getScalarizationOverhead(Ty, DemandedElts, Insert, Extract,
270 CostKind, ForPoisonSrc, VL, VIC);
276 Value *Scalar,
ArrayRef<std::tuple<Value *, User *, int>> ScalarUserAndIdx,
278 if (Opcode == Instruction::ExtractElement) {
280 assert(ReVec &&
"Only supported by REVEC.");
284 Index * VecTy->getNumElements(), VecTy);
287 return TTI.getVectorInstrCost(Opcode, Val, CostKind, Index, Scalar,
288 ScalarUserAndIdx, VIC);
292 bool ReVec,
unsigned Opcode,
Type *Dst,
296 assert(ReVec &&
"Only supported by REVEC.");
304 return TTI.getExtractWithExtendCost(Opcode, Dst, VecTy, Index, CostKind);
328 return TTI.getArithmeticReductionCost(
344 const Instruction *TruncI = TruncIt == ChainInsts.
end() ? nullptr : *TruncIt;
347 const Instruction *CmpI = CmpIt == ChainInsts.
end() ? nullptr : *CmpIt;
355 return TTI.getCastInstrCost(Instruction::Trunc, I1VecTy, VecTy,
356 TTI.getCastContextHint(TruncI), CostKind,
358 TTI.getCastInstrCost(Instruction::BitCast, IntTy, I1VecTy,
359 TTI.getCastContextHint(TruncI), CostKind) +
360 TTI.getCmpSelInstrCost(
363 CostKind,
TTI.getOperandInfo(Root),
TTI.getOperandInfo(CmpRHS),
373 "Expected and/or reduction of i1");
379 return TTI.getCastInstrCost(Instruction::BitCast, IntTy, VectorTy, Ctx,
381 TTI.getCmpSelInstrCost(Instruction::ICmp, IntTy,
387std::pair<InstructionCost, bool>
394 RdxOpcode, VectorTy, std::nullopt, CostKind);
397 return {std::min(RdxCost, BitcastCost), BitcastCost < RdxCost};
400 "Expected add reduction of zexted i1 values");
408 TTI.getCastInstrCost(Instruction::BitCast, IntTy, VectorTy, Ctx,
410 TTI.getIntrinsicInstrCost(
412 if (IntTy != ScalarTy)
413 ExplicitCost +=
TTI.getCastInstrCost(IntTy->getBitWidth() <
416 : Instruction::Trunc,
417 ScalarTy, IntTy, Ctx, CostKind);
419 TTI.getExtendedReductionCost(RdxOpcode,
true, ScalarTy,
420 VectorTy, std::nullopt, CostKind),
425 TTI.getCastInstrCost(Instruction::ZExt, ExtTy, VectorTy, Ctx, CostKind) +
426 TTI.getArithmeticReductionCost(RdxOpcode, ExtTy, std::nullopt, CostKind);
427 return {std::min(ExtRdxCost, CtpopCost), CtpopCost <= ExtRdxCost};
437 unsigned BitWidth = SrcTy->getScalarSizeInBits();
438 unsigned NumElts = SrcTy->getNumElements();
445 [](uint64_t
A) { return A == 0 || isPowerOf2_64(A); })
454 "The byte-multiple field width divides the result bit width.");
457 unsigned MinShiftWidth = 8;
458 while (MinShiftWidth < MaxAmt + Info.FieldWidth)
466 for (
unsigned W2 = MinShiftWidth; W2 <=
BitWidth; W2 *= 2) {
469 unsigned BytesPerLane = W2 / 8;
470 unsigned InBytes = NumElts * BytesPerLane;
474 PackTy, CCH, CostKind);
478 if (Info.FieldWidth < W2)
479 C +=
TTI.getCastInstrCost(Instruction::Trunc, FieldTy, ShiftTy,
481 if (IsReversed && Info.FieldWidth == 8) {
484 C +=
TTI.getIntrinsicInstrCost(CostAttrs, CostKind);
485 }
else if (IsReversed) {
495 C +=
TTI.getShuffleCost(
500 WideMask, 0,
nullptr, {}, CtxI);
501 if (InBytes > OutBytes)
503 PackTy, SrcByteTy, CostKind, {},
504 0, PackTy, {}, CtxI);
506 if (W2 !=
BitWidth && W2 != ZExtSrcWidth)
507 C +=
TTI.getCastInstrCost(Instruction::Trunc, ShiftTy, SrcTy, CCH,
509 if (Info.needsShift())
510 C +=
TTI.getArithmeticInstrCost(Instruction::LShr, ShiftTy, CostKind,
513 if (
C.isValid() && (!NewCost.
isValid() ||
C < NewCost)) {
523 Type *WideTy,
unsigned VF,
534 Cost +=
TTI.getArithmeticInstrCost(
535 Instruction::And, NarrowVecTy, CostKind,
542 Cost +=
TTI.getCmpSelInstrCost(
548 Instruction::BitCast, MaskTy, CmpTy,
550 if (MaskTy != WideTy)
552 TTI.getCastInstrCost(Instruction::ZExt, WideTy, MaskTy, CCH, CostKind);
562 if (
any_of(NarrowedLeafShifts,
563 [](
const auto &
P) {
return P.second.Shift != 0; }))
564 Cost +=
TTI.getArithmeticInstrCost(
565 Instruction::Shl, WideVecTy, CostKind, {TTI::OK_AnyValue, TTI::OP_None},
566 {TTI::OK_NonUniformConstantValue, TTI::OP_None}, {}, CtxI);
567 if (
any_of(NarrowedLeafShifts,
568 [](
const auto &
P) {
return !
P.second.Mask.isAllOnes(); }))
569 Cost +=
TTI.getArithmeticInstrCost(
570 Instruction::And, NarrowVecTy, CostKind,
571 {TTI::OK_AnyValue, TTI::OP_None},
572 {TTI::OK_NonUniformConstantValue, TTI::OP_None}, {}, CtxI);
578 const unsigned VF,
unsigned MinBW,
598std::pair<InstructionCost, InstructionCost>
610 LibCost =
TTI.getCallInstrCost(
nullptr, VecTy, ArgTys, CostKind);
617 FMF = FPCI->getFastMathFlags();
621 LibCost.isValid() ? LibCost : ScalarLimit);
623 if (LibCost.isValid()) {
649 "getVectorOpCost expects an arithmetic op or a vectorizable call.");
654 auto [IntrCost, LibCost] =
656 return std::min(IntrCost, LibCost);
659 return TTI.getArithmeticInstrCost(
668 return (
static_cast<unsigned>(Ty->getTypeID()) << 16) |
669 Ty->getScalarSizeInBits();
677 unsigned MaxVecRegSize) {
680 Type *Ty =
I->getType();
681 if ((Ty->isVectorTy() && !ReVec) || Ty->isAggregateType() ||
684 auto Analyze = [&]() {
688 constexpr unsigned MinVF = 2;
693 unsigned TyBits = Ty->getPrimitiveSizeInBits().getFixedValue();
695 return MaxVF > MinVF &&
708 return !isValidElementType(Arg->getType(), ReVec);
713 if (!CI->use_empty() && !CI->hasNUsesOrMore(
UsesLimit) &&
716 U, m_Select(m_Unless(m_Specific(CI)), m_Value(), m_Value()));
721 return CheckCached(Cache.CheapIntrinsics.contains(
Key),
722 [&] { Cache.CheapIntrinsics.insert(Key); });
727 const Function *Callee = CI->getCalledFunction();
730 return CheckCached(Cache.CheapCallees.contains(Callee),
731 [&] { Cache.CheapCallees.insert(Callee); });
734 return CheckCached(Cache.CheapOpcodes.contains(
Key),
735 [&] { Cache.CheapOpcodes.insert(Key); });
744 if (
FMul->getParent() ==
I->getParent())
747 return TTI.isProfitableToSinkOperands(
I, OpsToSink) &&
748 any_of(OpsToSink, [&](
const Use *U) {
return U->get() ==
FMul; });
755 const unsigned NumRegs =
TTI.getNumberOfRegisters(
756 TTI.getRegisterClassForType(
false, Ty));
757 auto IsLiveCandidate = [&](
const Value *V) {
767 if (Live.
size() > NumRegs)
778 std::tuple<const void *, FixedVectorType *, unsigned>>(
Value *)>
779 GetVectorizedSource) {
780 struct SourceVector {
788 for (
auto [Idx, VL] :
enumerate(GatheredScalars)) {
789 std::optional<std::tuple<Value *, unsigned, SmallVector<int>>> Fields =
793 auto &[Src, FieldWidth, Mask] = *Fields;
794 Type *SrcTy = Src->getType();
796 if (FieldWidth != 8 || NumFields % 2 != 0 ||
804 FieldVecTy, CostKind, Mask);
805 std::optional<std::tuple<const void *, FixedVectorType *, unsigned>>
806 Source = GetVectorizedSource(Src);
810 Source = std::make_tuple(
811 EE->getVectorOperand(),
815 if (BSwapCost <= PermuteCost)
816 BSwapGathers.
set(Idx);
819 auto &[Vec, VecTy, Lane] = *Source;
826 I += Lane * NumFields;
829 VecBytesTy, CostKind, {},
830 Lane * NumFields, FieldVecTy),
833 auto [It, Inserted] = SourceVectors.
try_emplace(Vec);
834 SourceVector &Info = It->second;
839 Info.DemandedElts.setBit(Lane);
840 Info.Cost += BSwapCost - PermuteCost;
841 Info.Gathers.push_back(Idx);
845 TTI, ReVec, Info.VecTy->getElementType(), Info.VecTy, Info.DemandedElts,
846 false,
true, CostKind);
847 if (Info.Cost + ExtractCost <= 0)
848 for (
unsigned Idx : Info.Gathers)
849 BSwapGathers.
set(Idx);
const TargetLowering & TLI
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file implements a class to represent arbitrary precision integral constant values and operations...
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
Provides some synthesis utilities to produce sequences of values.
This file defines the SmallPtrSet class.
This file defines the SmallVector class.
Class for arbitrary precision integers.
unsigned getBitWidth() const
Return the number of bits in the APInt.
static APInt getZero(unsigned numBits)
Get the '0' value for the specified bit-width.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
const T & front() const
Get the first element.
LLVM Basic Block Representation.
bool isNoBuiltin() const
Return true if the call should not be treated as a call to a builtin.
FunctionType * getFunctionType() const
iterator_range< User::op_iterator > args()
Iteration adapter for range-for loops.
This class represents a function call, abstracting a target machine's calling convention.
static Type * makeCmpResultType(Type *opnd_type)
Create a result type for fcmp/icmp.
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
This is an important base class in LLVM.
static LLVM_ABI Constant * getAllOnesValue(Type *Ty)
static LLVM_ABI Constant * getNullValue(Type *Ty)
Constructor to create a '0' constant of arbitrary type.
A parsed version of the target data layout string in and methods for querying it.
std::pair< iterator, bool > try_emplace(KeyT &&Key, Ts &&...Args)
static constexpr ElementCount getFixed(ScalarTy MinVal)
Convenience struct for specifying and reasoning about fast-math flags.
Class to represent fixed width SIMD vectors.
unsigned getNumElements() const
static LLVM_ABI FixedVectorType * get(Type *ElementType, unsigned NumElts)
static InstructionCost getInvalid(CostType Val=0)
static LLVM_ABI IntegerType * get(LLVMContext &C, unsigned NumBits)
This static method is the primary way of constructing an IntegerType.
Information for memory intrinsic cost model.
static LLVM_ABI unsigned getOpcode(RecurKind Kind)
Returns the opcode corresponding to the RecurrenceKind.
unsigned getOpcode() const
static LLVM_ABI bool isIdentityMask(ArrayRef< int > Mask, int NumSrcElts)
Return true if this shuffle mask chooses elements from exactly one source vector without lane crossin...
static LLVM_ABI bool isReverseMask(ArrayRef< int > Mask, int NumSrcElts)
Return true if this shuffle mask swaps the order of elements from exactly one source vector.
static LLVM_ABI bool isInsertSubvectorMask(ArrayRef< int > Mask, int NumSrcElts, int &NumSubElts, int &Index)
Return true if this shuffle mask is an insert subvector mask.
This is a 'bitvector' (really, a variable-sized bit array), optimized for the case when the array is ...
bool erase(PtrType Ptr)
Remove pointer from the set.
void insert_range(Range &&R)
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Provides information about what library functions are available for the current target.
The instances of the Type class are immutable: once they are created, they are never changed.
LLVM_ABI unsigned getIntegerBitWidth() const
static LLVM_ABI IntegerType * getInt8Ty(LLVMContext &C)
Type * getScalarType() const
If this is a vector type, return the element type, otherwise return 'this'.
LLVMContext & getContext() const
Return the LLVMContext in which this type was uniqued.
LLVM_ABI unsigned getScalarSizeInBits() const LLVM_READONLY
If this is a vector type, return the getPrimitiveSizeInBits value for the element type.
static LLVM_ABI IntegerType * getInt1Ty(LLVMContext &C)
bool isIntegerTy() const
True if this is an instance of IntegerType.
A Use represents the edge between a Value definition and its users.
The Vector Function Database.
static SmallVector< VFInfo, 8 > getMappings(const CallInst &CI)
Retrieve all the VFInfo instances associated to the CallInst CI.
LLVM Value Representation.
user_iterator user_begin()
bool hasOneUse() const
Return true if there is exactly one use of this value.
LLVMContext & getContext() const
All values hold a context through their type.
Base class of all SIMD vector types.
ElementCount getElementCount() const
Return an ElementCount instance to represent the (possibly scalable) number of elements in the vector...
static LLVM_ABI VectorType * get(Type *ElementType, ElementCount EC)
This static method is the primary way to construct an VectorType.
Type * getElementType() const
constexpr ScalarTy getKnownMinValue() const
Returns the minimum value this quantity can represent.
An efficient, type-erasing, non-owning reference to a callable.
Function * getVectorizedFunction(const VFShape &Shape) const
OneUse_match< SubPat > m_OneUse(const SubPat &SP)
BinaryOp_match< LHS, RHS, Instruction::FMul > m_FMul(const LHS &L, const RHS &R)
bool match(Val *V, const Pattern &P)
match_bind< Instruction > m_Instruction(Instruction *&I)
Match an instruction, capturing it if we match.
auto m_Value()
Match an arbitrary value and ignore it.
auto m_Intrinsic(const Ts &...Ops)
Match intrinsic calls like this: m_Intrinsic<Intrinsic::fabs>(m_Value(X))
AllowFmf_match< T, FastMathFlags::AllowContract > m_AllowContract(const T &SubPattern)
A private "module" namespace for types and utilities used by this pass.
std::pair< InstructionCost, bool > getI1ReductionCost(RecurKind Kind, const TargetTransformInfo &TTI, FixedVectorType *VectorTy, Type *ScalarTy, TTI::CastContextHint Ctx, TTI::TargetCostKind CostKind)
i1 reductions can be emitted as the plain target reduction or in the bitcast-based form (bitcast to a...
std::pair< InstructionCost, InstructionCost > getVectorCallCosts(CallInst *CI, Type *VecTy, const TargetTransformInfo &TTI, const TargetLibraryInfo &TLI, ArrayRef< Type * > ArgTys, const TTI::TargetCostKind CostKind)
Calculates the costs of vectorized intrinsic (if possible) and vectorized function (if possible) call...
InstructionCost getShuffleCost(const TargetTransformInfo &TTI, TTI::ShuffleKind Kind, VectorType *Tp, const TTI::TargetCostKind CostKind, ArrayRef< int > Mask, int Index, VectorType *SubTp, ArrayRef< const Value * > Args, TTI::VectorInstrContext VIC)
Returns the cost of the shuffle instructions with the given Kind, vector type Tp and optional Mask.
std::optional< unsigned > getElementIndex(const Value *Inst, unsigned Offset)
InstructionCost getNarrowedLeafOpsCost(const TargetTransformInfo &TTI, const SmallDenseMap< Value *, NarrowedLeafInfo > &NarrowedLeafShifts, VectorType *NarrowVecTy, VectorType *WideVecTy, const Instruction *CtxI, const TTI::TargetCostKind CostKind)
Returns the cost of the per-lane operations on the narrowed leaves NarrowedLeafShifts: the shl in the...
std::optional< std::tuple< Value *, unsigned, SmallVector< int > > > matchGatheredExtractedFields(ArrayRef< Value * > VL, const DataLayout &DL)
Checks if the values in VL are zero-extended sub-fields of the same wider integer scalar.
InstructionCost getBoolReduxBitcastCmpCost(const TargetTransformInfo &TTI, RecurKind RdxKind, FixedVectorType *VecTy, const Value *Root, ArrayRef< Instruction * > ChainInsts, const TTI::TargetCostKind CostKind)
Returns the cost of the booleanized logical and/or reduction of a vector of type VecTy with the i1 ro...
std::pair< InstructionCost, InstructionCost > getGEPCosts(const TargetTransformInfo &TTI, ArrayRef< Value * > Ptrs, Value *BasePtr, unsigned Opcode, const TTI::TargetCostKind CostKind, Type *ScalarTy, VectorType *VecTy)
Calculate the scalar and the vector costs from vectorizing set of GEPs.
Intrinsic::ID getMaskedDivRemIntrinsic(unsigned Opcode)
SmallVector< int > getBitPackMask(const BitPackInfo &Info, unsigned NumBytes, unsigned NumElts, unsigned BytesPerLane)
Returns the byte shuffle mask packing the per-lane fields of the shifted lanes (BytesPerLane bytes ea...
SmallVector< Type * > buildIntrinsicArgTypes(const CallInst *CI, const Intrinsic::ID ID, const unsigned VF, unsigned MinBW, const TargetTransformInfo &TTI)
Builds the arguments types vector for the given call instruction with the given ID for the specified ...
unsigned getNumElements(Type *Ty)
Type * getWidenedType(Type *ScalarTy, unsigned VF)
static unsigned getPoorThroughputTypeKey(Type *Ty)
Packs a type's kind and scalar width into one key, so an opcode/intrinsic id reused across scalar wid...
bool isPoorThroughputOp(bool ReVec, Instruction *I, const TargetTransformInfo &TTI, const TargetLibraryInfo &TLI, PoorThroughputOpCache &Cache, const TTI::TargetCostKind CostKind, unsigned MaxVecRegSize)
Returns true if I is an expensive scalar op whose vector form is cheaper per lane (e....
static TTI::CastContextHint getBoolReduxResultCCH(const Value *Root)
Returns the cast context hint for the trunc of the booleanized reduction result, which inherits the u...
InstructionCost getBlendedLoadCost(const TargetTransformInfo &TTI, Type *VecTy, Align Alignment, unsigned AddressSpace, const TTI::TargetCostKind CostKind)
Returns the cost of a BlendedLoadVectorize node loading VecTy: two masked loads (one per candidate ba...
FixedVectorType * getMaskedDivRemType(const TargetTransformInfo &TTI, unsigned Opcode, Type *ScalarTy, unsigned NumElts, bool ReVec)
For a non-power-of-2 NumElts-wide integer div/rem Opcode, returns the padded full-register vector typ...
InstructionCost getBoolBitmaskCost(const TargetTransformInfo &TTI, bool NeedMask, Type *NarrowScalarTy, Type *WideTy, unsigned VF, ArrayRef< int > PermMask, const Value *Root, const TTI::TargetCostKind CostKind)
Returns the cost of the boolean bitmask reduction of a vector of boolean leaves of type NarrowScalarT...
bool isFusableFMulOperand(Value *Op, Instruction *I, const TargetTransformInfo &TTI)
InstructionCost getBoolReduxWideRdxCost(const TargetTransformInfo &TTI, RecurKind RdxKind, FixedVectorType *VecTy, const Value *Root, FastMathFlags FMF, const TTI::TargetCostKind CostKind)
Returns the cost of the booleanized logical and/or reduction of a vector of type VecTy with the i1 ro...
InstructionCost getWidenedStridedCastCost(const TargetTransformInfo &TTI, Type *SrcTy, Type *DstTy, const DataLayout &DL, TTI::CastContextHint CCH, TTI::TargetCostKind CostKind)
Returns the cost of the cast between the widened strided access type and the entry vector type.
bool isValidElementType(Type *Ty, bool ReVec)
Predicate for the element types that the SLP vectorizer supports.
InstructionCost getScalarizationOverhead(const TargetTransformInfo &TTI, bool ReVec, Type *ScalarTy, VectorType *Ty, const APInt &DemandedElts, bool Insert, bool Extract, const TTI::TargetCostKind CostKind, bool ForPoisonSrc, ArrayRef< Value * > VL, TTI::VectorInstrContext VIC)
This is similar to TargetTransformInfo::getScalarizationOverhead, but if ScalarTy is a FixedVectorTyp...
bool hasHighRegisterPressure(unsigned ScheduleBudget, const BasicBlock &BB, Type *Ty, const TargetTransformInfo &TTI)
SmallBitVector selectBSwapGathers(ArrayRef< SmallVector< Value * > > GatheredScalars, const DataLayout &DL, const TargetTransformInfo &TTI, bool ReVec, TargetTransformInfo::TargetCostKind CostKind, function_ref< std::optional< std::tuple< const void *, FixedVectorType *, unsigned > >(Value *)> GetVectorizedSource)
Selects the gathers of GatheredScalars, which fully reverse the bytes of a scalar and are emitted as ...
InstructionCost getExtractWithExtendCost(const TargetTransformInfo &TTI, bool ReVec, unsigned Opcode, Type *Dst, VectorType *VecTy, unsigned Index, const TTI::TargetCostKind CostKind)
This is similar to TargetTransformInfo::getExtractWithExtendCost, but if Dst is a FixedVectorType,...
static InstructionCost getVectorOpCost(Instruction *I, unsigned VF, const TargetTransformInfo &TTI, const TargetLibraryInfo &TLI, const TTI::TargetCostKind CostKind)
static InstructionCost getBoolLogicRdxBitcastCost(RecurKind Kind, const TargetTransformInfo &TTI, FixedVectorType *VectorTy, TTI::CastContextHint Ctx, TTI::TargetCostKind CostKind)
constexpr int UsesLimit
Limit of the number of uses for potentially transformed instructions/values, used in checks to avoid ...
InstructionCost getVectorInstrCost(const TargetTransformInfo &TTI, bool ReVec, Type *ScalarTy, unsigned Opcode, Type *Val, const TTI::TargetCostKind CostKind, unsigned Index, Value *Scalar, ArrayRef< std::tuple< Value *, User *, int > > ScalarUserAndIdx, TTI::VectorInstrContext VIC)
This is similar to TargetTransformInfo::getVectorInstrCost, but if ScalarTy is a FixedVectorType,...
InstructionCost getMaskedDivRemCost(const TargetTransformInfo &TTI, bool ReVec, unsigned Opcode, Type *ScalarTy, unsigned NumElts, const TTI::TargetCostKind CostKind, FixedVectorType **PaddedTy)
For a non-power-of-2 NumElts-wide integer div/rem Opcode, checks if padding to a full register and us...
InstructionCost getBitPackCost(const TargetTransformInfo &TTI, FixedVectorType *SrcTy, Type *ResultTy, const BitPackInfo &Info, unsigned ZExtSrcWidth, TTI::CastContextHint CCH, TTI::TargetCostKind CostKind, const TargetLibraryInfo *TLI, const Instruction *CtxI, unsigned &ShiftWidth)
Returns the cost of the bitfield packing of SrcTy into ResultTy, picking the cheapest shift width.
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.
LLVM_ABI Intrinsic::ID getVectorIntrinsicIDForCall(const CallInst *CI, const TargetLibraryInfo *TLI)
Returns intrinsic ID for call.
auto enumerate(FirstRange &&First, RestRanges &&...Rest)
Given two or more input ranges, returns a new range whose values are tuples (A, B,...
Type * toScalarizedTy(Type *Ty)
A helper for converting vectorized types to scalarized (non-vector) types.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
bool isVectorizedTy(Type *Ty)
Returns true if Ty is a vector type or a struct of vector types where all vector types share the same...
constexpr bool isPowerOf2_64(uint64_t Value)
Return true if the argument is a power of two > 0 (64 bit edition.)
auto map_range(ContainerTy &&C, FuncTy F)
Return a range that applies F to the elements of C.
bool hasNItemsOrMore(IterTy &&Begin, IterTy &&End, unsigned N, Pred &&ShouldBeCounted=[](const decltype(*std::declval< IterTy >()) &) { return true;}, std::enable_if_t< !std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< std::remove_reference_t< decltype(Begin)> >::iterator_category >::value, void > *=nullptr)
Return true if the sequence [Begin, End) has N or more items.
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
auto reverse(ContainerTy &&C)
bool isPointerTy(const Type *T)
iterator_range< filter_iterator< detail::IterOfRange< RangeT >, PredicateT > > make_filter_range(RangeT &&Range, PredicateT Pred)
Convenience function that takes a range of elements and a predicate, and return a new filter_iterator...
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_ATTRIBUTE_VISIBILITY_DEFAULT AnalysisKey InnerAnalysisManagerProxy< AnalysisManagerT, IRUnitT, ExtraArgTs... >::Key
constexpr int PoisonMaskElem
RecurKind
These are the kinds of recurrences that we support.
@ Or
Bitwise or logical OR of integers.
@ And
Bitwise or logical AND of integers.
LLVM_ABI bool isVectorIntrinsicWithScalarOpAtArg(Intrinsic::ID ID, unsigned ScalarOpdIdx, const TargetTransformInfo *TTI)
Identifies if the vector form of the intrinsic has a scalar operand.
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...
auto make_second_range(ContainerTy &&c)
Given a container of pairs, return a range over the second elements.
constexpr unsigned BitWidth
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.
bool equal(L &&LRange, R &&RRange)
Wrapper function around std::equal to detect if pair-wise elements between two ranges are the same.
T bit_floor(T Value)
Returns the largest integral power of two no greater than Value if Value is nonzero.
constexpr detail::IsaCheckPredicate< Types... > IsaPred
Function object wrapper for the llvm::isa type check.
This struct is a compact representation of a valid (non-zero power of two) alignment.
static VFShape get(const FunctionType *FTy, ElementCount EC, bool HasGlobalPred)
Retrieve the basic vectorization shape of the function, where all parameters are mapped to VFParamKin...
Description of a bitfield packing of vector lanes into a scalar value: every lane contributes a disjo...
static constexpr unsigned NoLane
Memoizes opcode / intrinsic / callee kinds already ruled out as seeds.