LLVM  14.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 (Loop *OrigLoop, const TargetLibraryInfo *TLI, LoopVectorizationLegality *Legal, LoopVectorizationCostModel &CM, PredicatedScalarEvolution &PSE, VPBuilder &Builder)
 
VPRecipeOrVPValueTy tryToCreateWidenRecipe (Instruction *Instr, ArrayRef< VPValue * > Operands, VFRange &Range, VPlanPtr &Plan)
 Check if an existing VPValue can be used for Instr or a recipe can be create for I withing the given VF Range. More...
 
void setRecipe (Instruction *I, VPRecipeBase *R)
 Set the recipe created for given ingredient. More...
 
VPValuecreateBlockInMask (BasicBlock *BB, VPlanPtr &Plan)
 A helper function that computes the predicate of the block BB, assuming that the header block of the loop is set to True. More...
 
VPValuecreateEdgeMask (BasicBlock *Src, BasicBlock *Dst, VPlanPtr &Plan)
 A helper function that computes the predicate of the edge between SRC and DST. More...
 
void recordRecipeOf (Instruction *I)
 Mark given ingredient for recording its recipe once one is created for it. More...
 
VPRecipeBasegetRecipe (Instruction *I)
 Return the recipe created for given ingredient. More...
 
VPRegionBlockcreateReplicateRegion (Instruction *I, VPRecipeBase *PredRecipe, VPlanPtr &Plan)
 Create a replicating region for instruction I that requires predication. More...
 
VPBasicBlockhandleReplication (Instruction *I, VFRange &Range, VPBasicBlock *VPBB, VPlanPtr &Plan)
 Build a VPReplicationRecipe for I and enclose it within a Region if it is predicated. More...
 
void fixHeaderPhis ()
 Add the incoming values from the backedge to reduction & first-order recurrence cross-iteration phis. More...
 

Detailed Description

Helper class to create VPRecipies from IR instructions.

Definition at line 27 of file VPRecipeBuilder.h.

Constructor & Destructor Documentation

◆ VPRecipeBuilder()

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

Definition at line 108 of file VPRecipeBuilder.h.

References Builder, and llvm::IRSimilarity::Legal.

Member Function Documentation

◆ createBlockInMask()

VPValue * VPRecipeBuilder::createBlockInMask ( BasicBlock BB,
VPlanPtr Plan 
)

◆ createEdgeMask()

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

◆ createReplicateRegion()

VPRegionBlock * VPRecipeBuilder::createReplicateRegion ( Instruction I,
VPRecipeBase PredRecipe,
VPlanPtr Plan 
)

Create a replicating region for instruction I that requires predication.

PredRecipe is a VPReplicateRecipe holding I.

Definition at line 9086 of file LoopVectorize.cpp.

References assert(), llvm::Instruction::getOpcodeName(), and llvm::Instruction::getParent().

◆ fixHeaderPhis()

void VPRecipeBuilder::fixHeaderPhis ( )

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

Definition at line 8999 of file LoopVectorize.cpp.

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

◆ getRecipe()

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

◆ handleReplication()

VPBasicBlock * VPRecipeBuilder::handleReplication ( Instruction I,
VFRange Range,
VPBasicBlock VPBB,
VPlanPtr Plan 
)

Build a VPReplicationRecipe for I and enclose it within a Region if it is predicated.

Returns
VPBB augmented with this new recipe if I is not predicated, otherwise
a new VPBasicBlock that succeeds the new Region. Update the packing decision of predicated instructions if they feed I. Range.End may be decreased to ensure same recipe behavior from Range.Start to Range.End.

Definition at line 9009 of file LoopVectorize.cpp.

References llvm::VPBasicBlock::appendRecipe(), assert(), llvm::dbgs(), llvm::LoopVectorizationPlanner::getDecisionAndClampRange(), getIntrinsicID(), llvm::VPBlockBase::getSuccessors(), I, llvm::VPBlockUtils::insertBlockAfter(), llvm::LinearPolySize< LeafTy >::isScalable(), LLVM_DEBUG, llvm::VFRange::Start, and llvm::InnerLoopVectorizer::VF.

◆ recordRecipeOf()

void llvm::VPRecipeBuilder::recordRecipeOf ( Instruction I)
inline

◆ setRecipe()

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

Set the recipe created for given ingredient.

This operation is a no-op for ingredients that were not marked using a nullptr entry in the map.

Definition at line 125 of file VPRecipeBuilder.h.

References assert(), llvm::DenseMapBase< DenseMap< KeyT, ValueT, DenseMapInfo< KeyT >, llvm::detail::DenseMapPair< KeyT, ValueT > >, KeyT, ValueT, DenseMapInfo< KeyT >, llvm::detail::DenseMapPair< KeyT, ValueT > >::count(), and I.

◆ tryToCreateWidenRecipe()

VPRecipeOrVPValueTy VPRecipeBuilder::tryToCreateWidenRecipe ( Instruction Instr,
ArrayRef< VPValue * >  Operands,
VFRange Range,
VPlanPtr Plan 
)

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