|
LLVM 23.0.0git
|
Struct to hold various analysis needed for cost computations. More...
#include "Transforms/Vectorize/VPlanHelpers.h"
Public Member Functions | |
| VPCostContext (const TargetTransformInfo &TTI, const TargetLibraryInfo &TLI, const VPlan &Plan, LoopVectorizationCostModel &CM, TargetTransformInfo::TargetCostKind CostKind, PredicatedScalarEvolution &PSE, const Loop *L) | |
| InstructionCost | getLegacyCost (Instruction *UI, ElementCount VF) const |
Return the cost for UI with VF using the legacy cost model as fallback until computing the cost of all recipes migrates to VPlan. | |
| bool | skipCostComputation (Instruction *UI, bool IsVector) const |
Return true if the cost for UI shouldn't be computed, e.g. | |
| unsigned | getPredBlockCostDivisor (BasicBlock *BB) const |
| TargetTransformInfo::OperandValueInfo | getOperandInfo (VPValue *V) const |
Returns the OperandInfo for V, if it is a live-in. | |
| bool | isLegacyUniformAfterVectorization (Instruction *I, ElementCount VF) const |
Return true if I is considered uniform-after-vectorization in the legacy cost model for VF. | |
| InstructionCost | getScalarizationOverhead (Type *ResultTy, ArrayRef< const VPValue * > Operands, ElementCount VF, TTI::VectorInstrContext VIC=TTI::VectorInstrContext::None, bool AlwaysIncludeReplicatingR=false) |
Estimate the overhead of scalarizing a recipe with result type ResultTy and Operands with VF. | |
| bool | useEmulatedMaskMemRefHack (const VPReplicateRecipe *R, ElementCount VF) |
| Returns true if an artificially high cost for emulated masked memrefs should be used. | |
Public Attributes | |
| const TargetTransformInfo & | TTI |
| const TargetLibraryInfo & | TLI |
| VPTypeAnalysis | Types |
| LLVMContext & | LLVMCtx |
| LoopVectorizationCostModel & | CM |
| SmallPtrSet< Instruction *, 8 > | SkipCostComputation |
| TargetTransformInfo::TargetCostKind | CostKind |
| PredicatedScalarEvolution & | PSE |
| const Loop * | L |
| std::optional< unsigned > | NumPredStores |
| Number of predicated stores in the VPlan, computed on demand. | |
Struct to hold various analysis needed for cost computations.
Definition at line 338 of file VPlanHelpers.h.
|
inline |
| InstructionCost VPCostContext::getLegacyCost | ( | Instruction * | UI, |
| ElementCount | VF ) const |
Return the cost for UI with VF using the legacy cost model as fallback until computing the cost of all recipes migrates to VPlan.
Definition at line 6879 of file LoopVectorize.cpp.
References CM, llvm::ForceTargetInstructionCost, and InstructionCost.
| TargetTransformInfo::OperandValueInfo VPCostContext::getOperandInfo | ( | VPValue * | V | ) | const |
Returns the OperandInfo for V, if it is a live-in.
Definition at line 1773 of file VPlan.cpp.
References llvm::dyn_cast(), and llvm::TargetTransformInfo::getOperandInfo().
| unsigned VPCostContext::getPredBlockCostDivisor | ( | BasicBlock * | BB | ) | const |
Definition at line 6898 of file LoopVectorize.cpp.
| InstructionCost VPCostContext::getScalarizationOverhead | ( | Type * | ResultTy, |
| ArrayRef< const VPValue * > | Operands, | ||
| ElementCount | VF, | ||
| TTI::VectorInstrContext | VIC = TTI::VectorInstrContext::None, | ||
| bool | AlwaysIncludeReplicatingR = false ) |
Estimate the overhead of scalarizing a recipe with result type ResultTy and Operands with VF.
This is a convenience wrapper for the type-based getScalarizationOverhead API. VIC provides context about whether the scalarization is for a load/store operation. If AlwaysIncludeReplicatingR is true, always compute the cost of scalarizing replicating operands.
Definition at line 1780 of file VPlan.cpp.
References assert(), llvm::cast(), CostKind, llvm::APInt::getAllOnes(), llvm::getContainedTypes(), llvm::details::FixedOrScalableQuantity< LeafTy, ValueTy >::getFixedValue(), getOpcode(), llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::isa(), llvm::details::FixedOrScalableQuantity< LeafTy, ValueTy >::isScalable(), llvm::ElementCount::isScalar(), llvm::Type::isVoidTy(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::to_vector(), llvm::toVectorizedTy(), TTI, and Types.
| bool VPCostContext::isLegacyUniformAfterVectorization | ( | Instruction * | I, |
| ElementCount | VF ) const |
Return true if I is considered uniform-after-vectorization in the legacy cost model for VF.
Only used to check for additional VPlan simplifications.
Definition at line 6887 of file LoopVectorize.cpp.
Referenced by planContainsAdditionalSimplifications().
| bool VPCostContext::skipCostComputation | ( | Instruction * | UI, |
| bool | IsVector ) const |
Return true if the cost for UI shouldn't be computed, e.g.
because it has already been pre-computed.
Definition at line 6892 of file LoopVectorize.cpp.
References CM, and SkipCostComputation.
| bool VPCostContext::useEmulatedMaskMemRefHack | ( | const VPReplicateRecipe * | R, |
| ElementCount | VF ) |
Returns true if an artificially high cost for emulated masked memrefs should be used.
Definition at line 1818 of file VPlan.cpp.
References assert(), llvm::VPBlockUtils::blocksOnly(), llvm::dyn_cast(), llvm::VectorType::get(), llvm::VPRegionBlock::getEntry(), llvm::getLoadStoreAlignment(), llvm::VPlan::getVectorLoopRegion(), llvm::isa(), NumberOfStoresToPredicate, NumPredStores, TTI, Types, and llvm::vp_depth_first_shallow().
| LoopVectorizationCostModel& llvm::VPCostContext::CM |
Definition at line 343 of file VPlanHelpers.h.
Referenced by getLegacyCost(), getPredBlockCostDivisor(), isLegacyUniformAfterVectorization(), skipCostComputation(), and VPCostContext().
| TargetTransformInfo::TargetCostKind llvm::VPCostContext::CostKind |
Definition at line 345 of file VPlanHelpers.h.
Referenced by getPredBlockCostDivisor(), getScalarizationOverhead(), and VPCostContext().
Definition at line 347 of file VPlanHelpers.h.
Referenced by VPCostContext().
| LLVMContext& llvm::VPCostContext::LLVMCtx |
Definition at line 342 of file VPlanHelpers.h.
Referenced by VPCostContext().
| std::optional<unsigned> llvm::VPCostContext::NumPredStores |
Number of predicated stores in the VPlan, computed on demand.
Definition at line 350 of file VPlanHelpers.h.
Referenced by useEmulatedMaskMemRefHack().
| PredicatedScalarEvolution& llvm::VPCostContext::PSE |
Definition at line 346 of file VPlanHelpers.h.
Referenced by VPCostContext().
| SmallPtrSet<Instruction *, 8> llvm::VPCostContext::SkipCostComputation |
Definition at line 344 of file VPlanHelpers.h.
Referenced by skipCostComputation().
| const TargetLibraryInfo& llvm::VPCostContext::TLI |
Definition at line 340 of file VPlanHelpers.h.
Referenced by VPCostContext().
| const TargetTransformInfo& llvm::VPCostContext::TTI |
Definition at line 339 of file VPlanHelpers.h.
Referenced by getScalarizationOverhead(), useEmulatedMaskMemRefHack(), and VPCostContext().
| VPTypeAnalysis llvm::VPCostContext::Types |
Definition at line 341 of file VPlanHelpers.h.
Referenced by llvm::VPlanTransforms::createPartialReductions(), getScalarizationOverhead(), useEmulatedMaskMemRefHack(), and VPCostContext().