LLVM  11.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)
 
VPRecipeBasetryToCreateWidenRecipe (Instruction *Instr, VFRange &Range, VPlanPtr &Plan)
 Check if 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, DenseMap< Instruction *, VPReplicateRecipe *> &PredInst2Recipe, VPlanPtr &Plan)
 Build a VPReplicationRecipe for I and enclose it within a Region if it is predicated. More...
 

Detailed Description

Helper class to create VPRecipies from IR instructions.

Definition at line 24 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 93 of file VPRecipeBuilder.h.

References tryToCreateWidenRecipe().

Member Function Documentation

◆ createBlockInMask()

VPValue * VPRecipeBuilder::createBlockInMask ( 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.

It returns the entry mask for the block BB.

Definition at line 6804 of file LoopVectorize.cpp.

References llvm::VPInstruction::ActiveLaneMask, llvm::MCID::Add, llvm::CallBase::arg_operands(), assert(), llvm::InnerLoopVectorizer::Builder, llvm::LoopVectorizationCostModel::CM_Interleave, llvm::LoopVectorizationCostModel::CM_Scalarize, llvm::LoopVectorizationCostModel::CM_Unknown, llvm::LoopBase< BlockT, LoopT >::contains(), function, llvm::LoopVectorizationPlanner::getDecisionAndClampRange(), llvm::LoopBase< BlockT, LoopT >::getHeader(), llvm::PHINode::getIncomingBlock(), llvm::PHINode::getIncomingValue(), llvm::LoopVectorizationLegality::getInductionVars(), llvm::InductionDescriptor::getKind(), llvm::getLoadStorePointerOperand(), llvm::PHINode::getNumIncomingValues(), llvm::Instruction::getOpcode(), llvm::User::getOperand(), llvm::Instruction::getParent(), llvm::LoopVectorizationLegality::getPrimaryInduction(), llvm::StoreInst::getValueOperand(), llvm::getVectorIntrinsicIDForCall(), I, llvm::VPInstruction::ICmpULE, if(), llvm::InductionDescriptor::IK_FpInduction, llvm::InductionDescriptor::IK_IntInduction, llvm::tgtok::In, llvm::LoopVectorizationLegality::isMaskRequired(), llvm::InnerLoopVectorizer::Legal, llvm::SPII::Load, llvm::MapVector< KeyT, ValueT, MapType, VectorType >::lookup(), llvm::VPlan::mapToVPValues(), llvm::BitmaskEnumDetail::Mask(), Operands, llvm::User::operands(), llvm::InnerLoopVectorizer::OrigLoop, llvm::predecessors(), llvm::SmallVectorTemplateBase< T >::push_back(), llvm::MCID::Select, llvm::SPII::Store, llvm::InnerLoopVectorizer::TLI, and llvm::InnerLoopVectorizer::VF.

Referenced by setRecipe().

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

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

Referenced by getRecipe().

◆ getRecipe()

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

◆ handleReplication()

VPBasicBlock * VPRecipeBuilder::handleReplication ( Instruction I,
VFRange Range,
VPBasicBlock VPBB,
DenseMap< Instruction *, VPReplicateRecipe *> &  PredInst2Recipe,
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 7047 of file LoopVectorize.cpp.

References llvm::VPBasicBlock::appendRecipe(), assert(), llvm::dbgs(), llvm::SmallVectorBase< Size_T >::empty(), llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::find(), llvm::LoopVectorizationPlanner::getDecisionAndClampRange(), llvm::VPBlockBase::getSuccessors(), I, llvm::VPBlockUtils::insertBlockAfter(), LLVM_DEBUG, and llvm::User::operands().

Referenced by getRecipe().

◆ recordRecipeOf()

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

Mark given ingredient for recording its recipe once one is created for it.

Definition at line 126 of file VPRecipeBuilder.h.

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

◆ 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 107 of file VPRecipeBuilder.h.

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

◆ tryToCreateWidenRecipe()

VPRecipeBase * VPRecipeBuilder::tryToCreateWidenRecipe ( Instruction Instr,
VFRange Range,
VPlanPtr Plan 
)

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