|
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. | |
| void | invalidateWideningDecision (Instruction *I, ElementCount VF) |
Mark the widening decision for I at VF as invalidated since a VPlan transform replaced the original recipe. | |
| uint64_t | getPredBlockCostDivisor (BasicBlock *BB) const |
| bool | willBeScalarized (Instruction *I, ElementCount VF) const |
Returns true if I is known to be scalarized at VF. | |
| bool | isMaskRequired (Instruction *I) const |
| Forwards to LoopVectorizationCostModel::isMaskRequired. | |
| TargetTransformInfo::OperandValueInfo | getOperandInfo (VPValue *V) const |
Returns the OperandInfo for V, if it is a live-in. | |
| 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. | |
Static Public Member Functions | |
| static bool | isFreeScalarIntrinsic (Intrinsic::ID ID) |
Returns true if ID is a pseudo intrinsic that is dropped via scalarization rather than widened. | |
Public Attributes | |
| const TargetTransformInfo & | TTI |
| const TargetLibraryInfo & | TLI |
| 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 322 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 5598 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 1861 of file VPlan.cpp.
References llvm::dyn_cast(), and llvm::TargetTransformInfo::getOperandInfo().
| uint64_t VPCostContext::getPredBlockCostDivisor | ( | BasicBlock * | BB | ) | const |
Definition at line 5618 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 1868 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(), and TTI.
| void VPCostContext::invalidateWideningDecision | ( | Instruction * | I, |
| ElementCount | VF ) |
Mark the widening decision for I at VF as invalidated since a VPlan transform replaced the original recipe.
Definition at line 5612 of file LoopVectorize.cpp.
References CM, llvm::LoopVectorizationCostModel::CM_InvalidatedDecision, and I.
|
static |
Returns true if ID is a pseudo intrinsic that is dropped via scalarization rather than widened.
Definition at line 1946 of file VPlan.cpp.
References llvm::is_contained().
Referenced by llvm::VPReplicateRecipe::computeCallCost(), and decideCallWidening().
| bool VPCostContext::isMaskRequired | ( | Instruction * | I | ) | const |
Forwards to LoopVectorizationCostModel::isMaskRequired.
Definition at line 5628 of file LoopVectorize.cpp.
Referenced by decideCallWidening().
| 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 5606 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 1906 of file VPlan.cpp.
References assert(), llvm::VPBlockUtils::blocksOnly(), llvm::dyn_cast(), llvm::VectorType::get(), llvm::VPRegionBlock::getEntry(), llvm::getLoadStoreAlignment(), llvm::Type::getScalarType(), llvm::VPlan::getVectorLoopRegion(), llvm::isa(), NumberOfStoresToPredicate, NumPredStores, TTI, and llvm::vp_depth_first_shallow().
| bool VPCostContext::willBeScalarized | ( | Instruction * | I, |
| ElementCount | VF ) const |
Returns true if I is known to be scalarized at VF.
Definition at line 5622 of file LoopVectorize.cpp.
References CM, I, and llvm::ElementCount::isVector().
Referenced by decideCallWidening().
| LoopVectorizationCostModel& llvm::VPCostContext::CM |
Definition at line 326 of file VPlanHelpers.h.
Referenced by getLegacyCost(), getPredBlockCostDivisor(), invalidateWideningDecision(), isMaskRequired(), skipCostComputation(), VPCostContext(), and willBeScalarized().
| TargetTransformInfo::TargetCostKind llvm::VPCostContext::CostKind |
Definition at line 328 of file VPlanHelpers.h.
Referenced by llvm::VPReplicateRecipe::computeCost(), getPredBlockCostDivisor(), getScalarizationOverhead(), and VPCostContext().
Definition at line 330 of file VPlanHelpers.h.
Referenced by decideCallWidening(), and VPCostContext().
| LLVMContext& llvm::VPCostContext::LLVMCtx |
Definition at line 325 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 333 of file VPlanHelpers.h.
Referenced by useEmulatedMaskMemRefHack().
| PredicatedScalarEvolution& llvm::VPCostContext::PSE |
Definition at line 329 of file VPlanHelpers.h.
Referenced by decideCallWidening(), and VPCostContext().
| SmallPtrSet<Instruction *, 8> llvm::VPCostContext::SkipCostComputation |
Definition at line 327 of file VPlanHelpers.h.
Referenced by skipCostComputation().
| const TargetLibraryInfo& llvm::VPCostContext::TLI |
Definition at line 324 of file VPlanHelpers.h.
Referenced by decideCallWidening(), llvm::VPlanTransforms::makeCallWideningDecisions(), and VPCostContext().
| const TargetTransformInfo& llvm::VPCostContext::TTI |
Definition at line 323 of file VPlanHelpers.h.
Referenced by getScalarizationOverhead(), useEmulatedMaskMemRefHack(), and VPCostContext().