16#ifndef LLVM_LIB_TRANSFORMS_VECTORIZE_SLPVECTORIZER_SLPCOSTANALYSIS_H
17#define LLVM_LIB_TRANSFORMS_VECTORIZE_SLPVECTORIZER_SLPCOSTANALYSIS_H
60 ArrayRef<int> Mask = {},
int Index = 0,
63 TargetTransformInfo::VectorInstrContext::None);
66std::pair<InstructionCost, InstructionCost>
68 Value *BasePtr,
unsigned Opcode,
85 Type *DstTy,
const DataLayout &
DL,
95 Type *ScalarTy,
unsigned NumElts,
97 FixedVectorType **PaddedTy =
nullptr);
104 FixedVectorType *VecTy,
const Value *Root,
113 FixedVectorType *VecTy,
const Value *Root,
114 ArrayRef<Instruction *> ChainInsts,
123 Type *NarrowScalarTy,
Type *WideTy,
unsigned VF,
124 ArrayRef<int> PermMask,
const Value *Root,
131 const TargetTransformInfo &
TTI,
132 const SmallDenseMap<Value *, NarrowedLeafInfo> &NarrowedLeafShifts,
133 VectorType *NarrowVecTy, VectorType *WideVecTy,
const Instruction *CtxI,
141 Type *ScalarTy, VectorType *Ty,
142 const APInt &DemandedElts,
bool Insert,
bool Extract,
146 TargetTransformInfo::VectorInstrContext::None);
152 unsigned Opcode,
Type *Val,
154 unsigned Index,
Value *Scalar,
155 ArrayRef<std::tuple<Value *, User *, int>> ScalarUserAndIdx,
162 unsigned Opcode,
Type *Dst, VectorType *VecTy,
172 FixedVectorType *SrcTy,
Type *ResultTy,
176 const TargetLibraryInfo *
TLI,
177 const Instruction *CtxI,
unsigned &ShiftWidth);
184std::pair<InstructionCost, bool>
186 FixedVectorType *VectorTy,
Type *ScalarTy,
194 const unsigned VF,
unsigned MinBW,
195 const TargetTransformInfo &
TTI);
200std::pair<InstructionCost, InstructionCost>
222 unsigned MaxVecRegSize = 0);
249 std::tuple<const void *, FixedVectorType *, unsigned>>(
Value *)>
250 GetVectorizedSource);
const TargetLowering & TLI
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
This file defines the DenseMap class.
This file defines the DenseSet and SmallDenseSet classes.
This file defines an InstructionCost class that is used when calculating the cost of an instruction,...
This file implements the SmallBitVector class.
This file defines the SmallVector class.
Class for arbitrary precision integers.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
LLVM Basic Block Representation.
This class represents a function call, abstracting a target machine's calling convention.
A parsed version of the target data layout string in and methods for querying it.
Convenience struct for specifying and reasoning about fast-math flags.
Class to represent fixed width SIMD vectors.
This is a 'bitvector' (really, a variable-sized bit array), optimized for the case when the array is ...
Implements a dense probed hash-table based set with some number of buckets stored inline.
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 Value Representation.
Base class of all SIMD vector types.
An efficient, type-erasing, non-owning reference to a callable.
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
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.
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...
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.
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 ...
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....
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...
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.
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,...
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.
RelativeUniformCounterPtr ValuesPtrExpr VTableAddr Value
class LLVM_GSL_OWNER SmallVector
Forward declaration of SmallVector so that calculateSmallVectorDefaultInlinedElements can reference s...
RecurKind
These are the kinds of recurrences that we support.
DWARFExpression::Operation Op
ArrayRef(const T &OneElt) -> ArrayRef< T >
Description of a bitfield packing of vector lanes into a scalar value: every lane contributes a disjo...
Memoizes opcode / intrinsic / callee kinds already ruled out as seeds.
SmallDenseSet< const Function * > CheapCallees
SmallDenseSet< std::pair< Intrinsic::ID, unsigned > > CheapIntrinsics
SmallDenseSet< std::pair< unsigned, unsigned > > CheapOpcodes