LLVM 22.0.0git
|
Helper class to create VPRecipies from IR instructions. More...
#include "Transforms/Vectorize/VPRecipeBuilder.h"
Public Member Functions | |
VPRecipeBuilder (VPlan &Plan, Loop *OrigLoop, const TargetLibraryInfo *TLI, const TargetTransformInfo *TTI, LoopVectorizationLegality *Legal, LoopVectorizationCostModel &CM, PredicatedScalarEvolution &PSE, VPBuilder &Builder, DenseMap< VPBasicBlock *, VPValue * > &BlockMaskCache, LoopVersioning *LVer) | |
std::optional< unsigned > | getScalingForReduction (const Instruction *ExitInst) |
void | collectScaledReductions (VFRange &Range) |
Find all possible partial reductions in the loop and track all of those that are valid so recipes can be formed later. | |
VPRecipeBase * | tryToCreateWidenRecipe (VPSingleDefRecipe *R, VFRange &Range) |
Create and return a widened recipe for R if one can be created within the given VF Range . | |
VPRecipeBase * | tryToCreatePartialReduction (Instruction *Reduction, ArrayRef< VPValue * > Operands, unsigned ScaleFactor) |
Create and return a partial reduction recipe for a reduction instruction along with binary operation and reduction phi operands. | |
void | setRecipe (Instruction *I, VPRecipeBase *R) |
Set the recipe created for given ingredient. | |
VPValue * | getBlockInMask (VPBasicBlock *VPBB) const |
Returns the entry mask for block VPBB or null if the mask is all-true. | |
VPRecipeBase * | getRecipe (Instruction *I) |
Return the recipe created for given ingredient. | |
VPReplicateRecipe * | handleReplication (Instruction *I, ArrayRef< VPValue * > Operands, VFRange &Range) |
Build a VPReplicationRecipe for I using Operands . | |
VPValue * | getVPValueOrAddLiveIn (Value *V) |
void | updateBlockMaskCache (DenseMap< VPValue *, VPValue * > &Old2New) |
Helper class to create VPRecipies from IR instructions.
Definition at line 47 of file VPRecipeBuilder.h.
|
inline |
Definition at line 147 of file VPRecipeBuilder.h.
void VPRecipeBuilder::collectScaledReductions | ( | VFRange & | Range | ) |
Find all possible partial reductions in the loop and track all of those that are valid so recipes can be formed later.
Definition at line 7988 of file LoopVectorize.cpp.
References _, llvm::all_of(), llvm::PartialReductionChain::ExtendA, llvm::PartialReductionChain::ExtendB, llvm::SmallPtrSetImpl< PtrType >::insert(), Range, and llvm::PartialReductionChain::Reduction.
|
inline |
Returns the entry mask for block VPBB
or null if the mask is all-true.
Definition at line 187 of file VPRecipeBuilder.h.
Referenced by handleReplication(), and tryToCreatePartialReduction().
|
inline |
Return the recipe created for given ingredient.
Definition at line 192 of file VPRecipeBuilder.h.
Referenced by llvm::VPlanTransforms::createInterleaveGroups().
|
inline |
Definition at line 158 of file VPRecipeBuilder.h.
Referenced by tryToCreateWidenRecipe().
Definition at line 207 of file VPRecipeBuilder.h.
References llvm::dyn_cast(), and I.
VPReplicateRecipe * VPRecipeBuilder::handleReplication | ( | Instruction * | I, |
ArrayRef< VPValue * > | Operands, | ||
VFRange & | Range ) |
Build a VPReplicationRecipe for I
using Operands
.
If it is predicated, add the mask as last operand. Range.End may be decreased to ensure same recipe behavior from Range.Start
to Range.End
.
Definition at line 7924 of file LoopVectorize.cpp.
References assert(), llvm::cast(), llvm::dbgs(), getBlockInMask(), llvm::LoopVectorizationPlanner::getDecisionAndClampRange(), getIntrinsicID(), I, llvm::isa(), LLVM_DEBUG, Operands, and Range.
|
inline |
Set the recipe created for given ingredient.
Definition at line 179 of file VPRecipeBuilder.h.
VPRecipeBase * VPRecipeBuilder::tryToCreatePartialReduction | ( | Instruction * | Reduction, |
ArrayRef< VPValue * > | Operands, | ||
unsigned | ScaleFactor ) |
Create and return a partial reduction recipe for a reduction instruction along with binary operation and reduction phi operands.
Definition at line 8222 of file LoopVectorize.cpp.
References AbstractManglingParser< Derived, Alloc >::Ops, Accumulator, assert(), Cond, getBlockInMask(), llvm::VPValue::getDefiningRecipe(), llvm::isa(), Operands, and std::swap().
Referenced by tryToCreateWidenRecipe().
VPRecipeBase * VPRecipeBuilder::tryToCreateWidenRecipe | ( | VPSingleDefRecipe * | R, |
VFRange & | Range ) |
Create and return a widened recipe for R
if one can be created within the given VF Range
.
Definition at line 8134 of file LoopVectorize.cpp.
References llvm::VPUser::addOperand(), assert(), llvm::cast(), llvm::dyn_cast(), GEP, llvm::LoopVectorizationPlanner::getDecisionAndClampRange(), llvm::VPBasicBlock::getEnclosingLoopRegion(), llvm::VPRegionBlock::getEntry(), llvm::RecurrenceDescriptor::getLoopExitInstr(), llvm::Instruction::getOpcode(), llvm::VPBlockBase::getParent(), llvm::RecurrenceDescriptor::getRecurrenceKind(), llvm::RecurrenceDescriptor::getRecurrenceStartValue(), getScalingForReduction(), llvm::Value::getType(), llvm::isa(), llvm::ElementCount::isScalar(), Operands, Range, and tryToCreatePartialReduction().
|
inline |
Definition at line 215 of file VPRecipeBuilder.h.
References _, and llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::lookup().