LLVM 22.0.0git
llvm::VPRecipeBuilder Class Reference

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< unsignedgetScalingForReduction (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.
VPRecipeBasetryToCreateWidenRecipe (VPSingleDefRecipe *R, VFRange &Range)
 Create and return a widened recipe for R if one can be created within the given VF Range.
VPRecipeBasetryToCreatePartialReduction (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.
VPValuegetBlockInMask (VPBasicBlock *VPBB) const
 Returns the entry mask for block VPBB or null if the mask is all-true.
VPRecipeBasegetRecipe (Instruction *I)
 Return the recipe created for given ingredient.
VPReplicateRecipehandleReplication (Instruction *I, ArrayRef< VPValue * > Operands, VFRange &Range)
 Build a VPReplicationRecipe for I using Operands.
VPValuegetVPValueOrAddLiveIn (Value *V)
void updateBlockMaskCache (DenseMap< VPValue *, VPValue * > &Old2New)

Detailed Description

Helper class to create VPRecipies from IR instructions.

Definition at line 47 of file VPRecipeBuilder.h.

Constructor & Destructor Documentation

◆ VPRecipeBuilder()

llvm::VPRecipeBuilder::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 )
inline

Definition at line 147 of file VPRecipeBuilder.h.

Member Function Documentation

◆ collectScaledReductions()

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.

◆ getBlockInMask()

VPValue * llvm::VPRecipeBuilder::getBlockInMask ( VPBasicBlock * VPBB) const
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().

◆ getRecipe()

VPRecipeBase * llvm::VPRecipeBuilder::getRecipe ( Instruction * I)
inline

Return the recipe created for given ingredient.

Definition at line 192 of file VPRecipeBuilder.h.

References assert(), and I.

Referenced by llvm::VPlanTransforms::createInterleaveGroups().

◆ getScalingForReduction()

std::optional< unsigned > llvm::VPRecipeBuilder::getScalingForReduction ( const Instruction * ExitInst)
inline

Definition at line 158 of file VPRecipeBuilder.h.

Referenced by tryToCreateWidenRecipe().

◆ getVPValueOrAddLiveIn()

VPValue * llvm::VPRecipeBuilder::getVPValueOrAddLiveIn ( Value * V)
inline

Definition at line 207 of file VPRecipeBuilder.h.

References llvm::dyn_cast(), and I.

◆ handleReplication()

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.

◆ setRecipe()

void llvm::VPRecipeBuilder::setRecipe ( Instruction * I,
VPRecipeBase * R )
inline

Set the recipe created for given ingredient.

Definition at line 179 of file VPRecipeBuilder.h.

References assert(), and I.

◆ tryToCreatePartialReduction()

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().

◆ tryToCreateWidenRecipe()

◆ updateBlockMaskCache()

void llvm::VPRecipeBuilder::updateBlockMaskCache ( DenseMap< VPValue *, VPValue * > & Old2New)
inline

The documentation for this class was generated from the following files: