LLVM 20.0.0git
Public Member Functions | List of all members
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, LoopVectorizationLegality *Legal, LoopVectorizationCostModel &CM, PredicatedScalarEvolution &PSE, VPBuilder &Builder)
 
VPRecipeBasetryToCreateWidenRecipe (Instruction *Instr, ArrayRef< VPValue * > Operands, VFRange &Range, VPBasicBlock *VPBB)
 Create and return a widened recipe for I if one can be created within the given VF Range.
 
void setRecipe (Instruction *I, VPRecipeBase *R)
 Set the recipe created for given ingredient.
 
void createHeaderMask ()
 Create the mask for the vector loop header block.
 
void createBlockInMask (BasicBlock *BB)
 A helper function that computes the predicate of the block BB, assuming that the header block of the loop is set to True or the loop mask when tail folding.
 
VPValuegetBlockInMask (BasicBlock *BB) const
 Returns the entry mask for the block BB.
 
void createSwitchEdgeMasks (SwitchInst *SI)
 Create an edge mask for every destination of cases and/or default.
 
VPValuecreateEdgeMask (BasicBlock *Src, BasicBlock *Dst)
 A helper function that computes the predicate of the edge between SRC and DST.
 
VPValuegetEdgeMask (BasicBlock *Src, BasicBlock *Dst) const
 A helper that returns the previously computed predicate of the edge between SRC and DST.
 
VPRecipeBasegetRecipe (Instruction *I)
 Return the recipe created for given ingredient.
 
VPReplicateRecipehandleReplication (Instruction *I, VFRange &Range)
 Build a VPReplicationRecipe for I.
 
void fixHeaderPhis ()
 Add the incoming values from the backedge to reduction & first-order recurrence cross-iteration phis.
 
iterator_range< mapped_iterator< Use *, std::function< VPValue *(Value *)> > > mapToVPValues (User::op_range Operands)
 Returns a range mapping the values of the range Operands to their corresponding VPValues.
 
VPValuegetVPValueOrAddLiveIn (Value *V, VPlan &Plan)
 

Detailed Description

Helper class to create VPRecipies from IR instructions.

Definition at line 25 of file VPRecipeBuilder.h.

Constructor & Destructor Documentation

◆ VPRecipeBuilder()

llvm::VPRecipeBuilder::VPRecipeBuilder ( VPlan Plan,
Loop OrigLoop,
const TargetLibraryInfo TLI,
LoopVectorizationLegality Legal,
LoopVectorizationCostModel CM,
PredicatedScalarEvolution PSE,
VPBuilder Builder 
)
inline

Definition at line 106 of file VPRecipeBuilder.h.

References llvm::IRSimilarity::Legal.

Member Function Documentation

◆ createBlockInMask()

void VPRecipeBuilder::createBlockInMask ( BasicBlock BB)

A helper function that computes the predicate of the block BB, assuming that the header block of the loop is set to True or the loop mask when tail folding.

Definition at line 7998 of file LoopVectorize.cpp.

References assert(), llvm::LoopBase< BlockT, LoopT >::contains(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::count(), createEdgeMask(), llvm::VPBuilder::createOr(), llvm::LoopBase< BlockT, LoopT >::getHeader(), llvm::pred_begin(), and llvm::pred_end().

◆ createEdgeMask()

VPValue * VPRecipeBuilder::createEdgeMask ( BasicBlock Src,
BasicBlock Dst 
)

◆ createHeaderMask()

void VPRecipeBuilder::createHeaderMask ( )

◆ createSwitchEdgeMasks()

void VPRecipeBuilder::createSwitchEdgeMasks ( SwitchInst SI)

◆ fixHeaderPhis()

void VPRecipeBuilder::fixHeaderPhis ( )

Add the incoming values from the backedge to reduction & first-order recurrence cross-iteration phis.

Definition at line 8334 of file LoopVectorize.cpp.

References llvm::LoopBase< BlockT, LoopT >::getLoopLatch(), getRecipe(), and llvm::VPDef::getVPSingleValue().

◆ getBlockInMask()

VPValue * VPRecipeBuilder::getBlockInMask ( BasicBlock BB) const

◆ getEdgeMask()

VPValue * VPRecipeBuilder::getEdgeMask ( BasicBlock Src,
BasicBlock Dst 
) const

A helper that returns the previously computed predicate of the edge between SRC and DST.

Definition at line 7952 of file LoopVectorize.cpp.

References assert(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find(), llvm::is_contained(), and llvm::predecessors().

◆ getRecipe()

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

Return the recipe created for given ingredient.

Definition at line 149 of file VPRecipeBuilder.h.

References assert(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::count(), and I.

Referenced by fixHeaderPhis().

◆ getVPValueOrAddLiveIn()

VPValue * llvm::VPRecipeBuilder::getVPValueOrAddLiveIn ( Value V,
VPlan Plan 
)
inline

◆ handleReplication()

VPReplicateRecipe * VPRecipeBuilder::handleReplication ( Instruction I,
VFRange Range 
)

Build a VPReplicationRecipe for I.

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 8344 of file LoopVectorize.cpp.

References assert(), llvm::dbgs(), getBlockInMask(), llvm::LoopVectorizationPlanner::getDecisionAndClampRange(), getIntrinsicID(), I, llvm::LoopVectorizationCostModel::isPredicatedInst(), llvm::LoopVectorizationCostModel::isUniformAfterVectorization(), LLVM_DEBUG, mapToVPValues(), and Range.

◆ mapToVPValues()

iterator_range< mapped_iterator< Use *, std::function< VPValue *(Value *)> > > VPRecipeBuilder::mapToVPValues ( User::op_range  Operands)

Returns a range mapping the values of the range Operands to their corresponding VPValues.

Definition at line 7840 of file LoopVectorize.cpp.

References llvm::VPlan::getOrAddLiveIn(), I, llvm::map_range(), and Operands.

Referenced by handleReplication().

◆ setRecipe()

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

Set the recipe created for given ingredient.

Definition at line 120 of file VPRecipeBuilder.h.

References assert(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::contains(), and I.

◆ tryToCreateWidenRecipe()

VPRecipeBase * VPRecipeBuilder::tryToCreateWidenRecipe ( Instruction Instr,
ArrayRef< VPValue * >  Operands,
VFRange Range,
VPBasicBlock VPBB 
)

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