class VPRecipeBuilder

Declaration

class VPRecipeBuilder { /* full declaration omitted */ };

Description

Helper class to create VPRecipies from IR instructions.

Declared at: llvm/lib/Transforms/Vectorize/VPRecipeBuilder.h:25

Method Overview

  • public VPRecipeBuilder(llvm::Loop * OrigLoop, const llvm::TargetLibraryInfo * TLI, llvm::LoopVectorizationLegality * Legal, llvm::LoopVectorizationCostModel & CM, llvm::VPBuilder & Builder)
  • public llvm::VPValue * createBlockInMask(llvm::BasicBlock * BB, llvm::VPlanPtr & Plan)
  • public llvm::VPValue * createEdgeMask(llvm::BasicBlock * Src, llvm::BasicBlock * Dst, llvm::VPlanPtr & Plan)
  • public llvm::VPRegionBlock * createReplicateRegion(llvm::Instruction * I, llvm::VPRecipeBase * PredRecipe, llvm::VPlanPtr & Plan)
  • public llvm::VPRecipeBase * getRecipe(llvm::Instruction * I)
  • public llvm::VPBasicBlock * handleReplication(llvm::Instruction * I, llvm::VFRange & Range, llvm::VPBasicBlock * VPBB, DenseMap<llvm::Instruction *, llvm::VPReplicateRecipe *> & PredInst2Recipe, llvm::VPlanPtr & Plan)
  • public void recordRecipeOf(llvm::Instruction * I)
  • public llvm::VPBlendRecipe * tryToBlend(llvm::Instruction * I, llvm::VPlanPtr & Plan)
  • public bool tryToCreateRecipe(llvm::Instruction * Instr, llvm::VFRange & Range, llvm::VPlanPtr & Plan, llvm::VPBasicBlock * VPBB)
  • public llvm::VPWidenIntOrFpInductionRecipe * tryToOptimizeInduction(llvm::Instruction * I, llvm::VFRange & Range)
  • public bool tryToWiden(llvm::Instruction * I, llvm::VPBasicBlock * VPBB, llvm::VFRange & Range)
  • public llvm::VPWidenMemoryInstructionRecipe * tryToWidenMemory(llvm::Instruction * I, llvm::VFRange & Range, llvm::VPlanPtr & Plan)

Methods

VPRecipeBuilder(
    llvm::Loop* OrigLoop,
    const llvm::TargetLibraryInfo* TLI,
    llvm::LoopVectorizationLegality* Legal,
    llvm::LoopVectorizationCostModel& CM,
    llvm::VPBuilder& Builder)

Declared at: llvm/lib/Transforms/Vectorize/VPRecipeBuilder.h:127

Parameters

llvm::Loop* OrigLoop
const llvm::TargetLibraryInfo* TLI
llvm::LoopVectorizationLegality* Legal
llvm::LoopVectorizationCostModel& CM
llvm::VPBuilder& Builder

llvm::VPValue* createBlockInMask(
    llvm::BasicBlock* BB,
    llvm::VPlanPtr& Plan)

Description

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.

Declared at: llvm/lib/Transforms/Vectorize/VPRecipeBuilder.h:72

Parameters

llvm::BasicBlock* BB
llvm::VPlanPtr& Plan

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

Description

A helper function that computes the predicate of the edge between SRC and DST.

Declared at: llvm/lib/Transforms/Vectorize/VPRecipeBuilder.h:76

Parameters

llvm::BasicBlock* Src
llvm::BasicBlock* Dst
llvm::VPlanPtr& Plan

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

Description

Create a replicating region for instruction \p I that requires predication. \p PredRecipe is a VPReplicateRecipe holding \p I.

Declared at: llvm/lib/Transforms/Vectorize/VPRecipeBuilder.h:123

Parameters

llvm::Instruction* I
llvm::VPRecipeBase* PredRecipe
llvm::VPlanPtr& Plan

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

Description

Return the recipe created for given ingredient.

Declared at: llvm/lib/Transforms/Vectorize/VPRecipeBuilder.h:87

Parameters

llvm::Instruction* I

llvm::VPBasicBlock* handleReplication(
    llvm::Instruction* I,
    llvm::VFRange& Range,
    llvm::VPBasicBlock* VPBB,
    DenseMap<llvm::Instruction*,
             llvm::VPReplicateRecipe*>&
        PredInst2Recipe,
    llvm::VPlanPtr& Plan)

Description

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

Declared at: llvm/lib/Transforms/Vectorize/VPRecipeBuilder.h:143

Parameters

llvm::Instruction* I
llvm::VFRange& Range
llvm::VPBasicBlock* VPBB
DenseMap<llvm::Instruction*, llvm::VPReplicateRecipe*>& PredInst2Recipe
llvm::VPlanPtr& Plan

Returns

a new VPBasicBlock that succeeds the new Region. Update the packing decision of predicated instructions if they feed \p I. Range.End may be decreased to ensure same recipe behavior from\p Range.Start to \p Range.End.

void recordRecipeOf(llvm::Instruction* I)

Description

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

Declared at: llvm/lib/Transforms/Vectorize/VPRecipeBuilder.h:80

Parameters

llvm::Instruction* I

llvm::VPBlendRecipe* tryToBlend(
    llvm::Instruction* I,
    llvm::VPlanPtr& Plan)

Description

Handle non-loop phi nodes. Currently all such phi nodes are turned into a sequence of select instructions as the vectorizer currently performs full if-conversion.

Declared at: llvm/lib/Transforms/Vectorize/VPRecipeBuilder.h:111

Parameters

llvm::Instruction* I
llvm::VPlanPtr& Plan

bool tryToCreateRecipe(llvm::Instruction* Instr,
                       llvm::VFRange& Range,
                       llvm::VPlanPtr& Plan,
                       llvm::VPBasicBlock* VPBB)

Description

Check if a recipe can be create for \p I withing the given VF \p Range. If a recipe can be created, it adds it to \p VPBB.

Declared at: llvm/lib/Transforms/Vectorize/VPRecipeBuilder.h:134

Parameters

llvm::Instruction* Instr
llvm::VFRange& Range
llvm::VPlanPtr& Plan
llvm::VPBasicBlock* VPBB

llvm::VPWidenIntOrFpInductionRecipe*
tryToOptimizeInduction(llvm::Instruction* I,
                       llvm::VFRange& Range)

Description

Check if an induction recipe should be constructed for \Iwithin the given VF \p Range. If so build and return it. If not, return null. \p Range.End may be decreased to ensure same decision from \p Range.Start to\p Range.End.

Declared at: llvm/lib/Transforms/Vectorize/VPRecipeBuilder.h:105

Parameters

llvm::Instruction* I
llvm::VFRange& Range

bool tryToWiden(llvm::Instruction* I,
                llvm::VPBasicBlock* VPBB,
                llvm::VFRange& Range)

Description

Check if \p I can be widened within the given VF \p Range. If \p I can be widened for \p Range.Start, check if the last recipe of \p VPBB can be extended to include \p I or else build a new VPWidenRecipe for it and append it to \p VPBB. Return true if \p I can be widened for Range.Start, false otherwise. Range.End may be decreased to ensure same decision from\p Range.Start to \p Range.End.

Declared at: llvm/lib/Transforms/Vectorize/VPRecipeBuilder.h:119

Parameters

llvm::Instruction* I
llvm::VPBasicBlock* VPBB
llvm::VFRange& Range

llvm::VPWidenMemoryInstructionRecipe*
tryToWidenMemory(llvm::Instruction* I,
                 llvm::VFRange& Range,
                 llvm::VPlanPtr& Plan)

Description

Check if \Iis a memory instruction to be widened for \p Range.Start and potentially masked. Such instructions are handled by a recipe that takes an additional VPInstruction for the mask.

Declared at: llvm/lib/Transforms/Vectorize/VPRecipeBuilder.h:99

Parameters

llvm::Instruction* I
llvm::VFRange& Range
llvm::VPlanPtr& Plan