35 return TTI.getShuffleCost(Kind, DstTy, Tp, Mask,
CostKind, Index, SubTp,
40 Mask, NumSrcElts, NumSubElts, Index)) {
41 if (Index + NumSubElts > NumSrcElts &&
42 Index + NumSrcElts <=
static_cast<int>(Mask.size()))
46 return TTI.getShuffleCost(Kind, DstTy, Tp, Mask,
CostKind, Index, SubTp,
50std::pair<InstructionCost, InstructionCost>
61 if (Opcode == Instruction::Load || Opcode == Instruction::Store) {
70 ScalarCost =
TTI.getPointersChainCost(
71 Ptrs, BasePtr, TTI::PointersChainInfo::getUnitStride(), ScalarTy,
75 for (
Value *V : Ptrs) {
85 if (!Ptr || !Ptr->hasOneUse())
89 if (PtrsRetainedInVecCode.
size() == Ptrs.size()) {
94 VecCost =
TTI.getPointersChainCost(PtrsRetainedInVecCode, BasePtr,
95 TTI::PointersChainInfo::getKnownStride(),
107 return Ptr && !Ptr->hasAllConstantIndices();
109 ? TTI::PointersChainInfo::getUnknownStride()
110 : TTI::PointersChainInfo::getKnownStride();
113 TTI.getPointersChainCost(Ptrs, BasePtr, PtrsInfo, ScalarTy,
CostKind);
117 if (It != Ptrs.
end())
122 VecCost =
TTI.getGEPCost(BaseGEP->getSourceElementType(),
123 BaseGEP->getPointerOperand(), Indices, VecTy,
128 return std::make_pair(ScalarCost, VecCost);
static cl::opt< OutputCostKind > CostKind("cost-kind", cl::desc("Target cost kind"), cl::init(OutputCostKind::RecipThroughput), cl::values(clEnumValN(OutputCostKind::RecipThroughput, "throughput", "Reciprocal throughput"), clEnumValN(OutputCostKind::Latency, "latency", "Instruction latency"), clEnumValN(OutputCostKind::CodeSize, "code-size", "Code size"), clEnumValN(OutputCostKind::SizeAndLatency, "size-latency", "Code size and latency"), clEnumValN(OutputCostKind::All, "all", "Print all cost kinds")))
This file defines the SmallVector class.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
static LLVM_ABI FixedVectorType * get(Type *ElementType, unsigned NumElts)
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.
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
The instances of the Type class are immutable: once they are created, they are never changed.
Type * getScalarType() const
If this is a vector type, return the element type, otherwise return 'this'.
LLVM Value Representation.
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...
constexpr ScalarTy getKnownMinValue() const
Returns the minimum value this quantity can represent.
A private "module" namespace for types and utilities used by this pass.
std::pair< InstructionCost, InstructionCost > getGEPCosts(const TargetTransformInfo &TTI, ArrayRef< Value * > Ptrs, Value *BasePtr, unsigned Opcode, TTI::TargetCostKind CostKind, Type *ScalarTy, VectorType *VecTy)
Calculate the scalar and the vector costs from vectorizing set of GEPs.
InstructionCost getShuffleCost(const TargetTransformInfo &TTI, TTI::ShuffleKind Kind, VectorType *Tp, ArrayRef< int > Mask, TTI::TargetCostKind CostKind, int Index, VectorType *SubTp, ArrayRef< const Value * > Args)
Returns the cost of the shuffle instructions with the given Kind, vector type Tp and optional Mask.
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.
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 detail::IsaCheckPredicate< Types... > IsaPred
Function object wrapper for the llvm::isa type check.