class VPlan
Declaration
class VPlan { /* full declaration omitted */ };
Description
VPlan models a candidate for vectorization, encoding various decisions take to produce efficient output IR, including which branches, basic-blocks and output IR instructions to generate, and their cost. VPlan holds a Hierarchical-CFG of VPBasicBlocks and VPRegionBlocks rooted at an Entry VPBlock.
Declared at: llvm/lib/Transforms/Vectorize/VPlan.h:2498
Member Variables
- private llvm::VPBlockBase* Entry
- Hold the single entry to the Hierarchical CFG of the VPlan.
- private SmallSetVector<llvm::ElementCount, 2> VFs
- Holds the VFs applicable to this VPlan.
- private std::string Name
- Holds the name of the VPlan, for printing.
- private DenseMap<llvm::Value*, llvm::VPValue*> VPExternalDefs
- Holds all the external definitions created for this VPlan. External definitions must be immutable and hold a pointer to their underlying IR.
- private llvm::VPValue* TripCount = nullptr
- Represents the trip count of the original loop, for folding the tail.
- private llvm::VPValue* BackedgeTakenCount = nullptr
- Represents the backedge taken count of the original loop, for folding the tail. It equals TripCount - 1.
- private llvm::VPValue VectorTripCount
- Represents the vector trip count.
- private llvm::Value2VPValueTy Value2VPValue
- Holds a mapping between Values and their corresponding VPValue inside VPlan.
- private SmallVector<llvm::VPValue*, 16> VPValuesToFree
- Contains all VPValues that been allocated by addVPValue directly and need to be free when the plan's destructor is called.
- private bool Value2VPValueEnabled = true
- Indicates whether it is safe use the Value2VPValue mapping or if the mapping cannot be used any longer, because it is stale.
- private MapVector<llvm::PHINode*, llvm::VPLiveOut*> LiveOuts
- Values used outside the plan.
Method Overview
- public VPlan(llvm::VPBlockBase * Entry = nullptr)
- public void addLiveOut(llvm::PHINode * PN, llvm::VPValue * V)
- public void addVF(llvm::ElementCount VF)
- public void addVPValue(llvm::Value * V, llvm::VPValue * VPV)
- public void addVPValue(llvm::Value * V)
- public void clearLiveOuts()
- public void disableValue2VPValue()
- public void dump() const
- public void execute(struct VPTransformState * State)
- public llvm::VPActiveLaneMaskPHIRecipe * getActiveLaneMaskPhi()
- public llvm::VPCanonicalIVPHIRecipe * getCanonicalIV()
- public llvm::VPBlockBase * getEntry()
- public const llvm::VPBlockBase * getEntry() const
- public const MapVector<llvm::PHINode *, llvm::VPLiveOut *> & getLiveOuts() const
- public const std::string & getName() const
- public llvm::VPValue * getOrAddExternalDef(llvm::Value * V)
- public llvm::VPValue * getOrAddVPValue(llvm::Value * V, bool OverrideAllowed = false)
- public llvm::VPValue * getOrCreateBackedgeTakenCount()
- public llvm::VPValue * getOrCreateTripCount()
- public llvm::VPValue * getVPValue(llvm::Value * V, bool OverrideAllowed = false)
- public const llvm::VPRegionBlock * getVectorLoopRegion() const
- public llvm::VPRegionBlock * getVectorLoopRegion()
- public llvm::VPValue & getVectorTripCount()
- public bool hasVF(llvm::ElementCount VF)
- public bool isUniformAfterVectorization(llvm::VPValue * VPV) const
- public iterator_range<mapped_iterator<llvm::Use *, std::function<VPValue *(Value *)>>> mapToVPValues(User::op_range Operands)
- public void prepareToExecute(llvm::Value * TripCount, llvm::Value * VectorTripCount, llvm::Value * CanonicalIVStartValue, llvm::VPTransformState & State, bool IsEpilogueVectorization)
- public void print(llvm::raw_ostream & O) const
- public void printDOT(llvm::raw_ostream & O) const
- public void removeLiveOut(llvm::PHINode * PN)
- public void removeVPValueFor(llvm::Value * V)
- public llvm::VPBlockBase * setEntry(llvm::VPBlockBase * Block)
- public void setName(const llvm::Twine & newName)
- private static void updateDominatorTree(llvm::DominatorTree * DT, llvm::BasicBlock * LoopLatchBB, llvm::BasicBlock * LoopPreHeaderBB, llvm::BasicBlock * LoopExitBB)
- public ~VPlan()
Methods
¶VPlan(llvm::VPBlockBase* Entry = nullptr)
VPlan(llvm::VPBlockBase* Entry = nullptr)
Declared at: llvm/lib/Transforms/Vectorize/VPlan.h:2542
Parameters
- llvm::VPBlockBase* Entry = nullptr
¶void addLiveOut(llvm::PHINode* PN,
llvm::VPValue* V)
void addLiveOut(llvm::PHINode* PN,
llvm::VPValue* V)
Declared at: llvm/lib/Transforms/Vectorize/VPlan.h:2715
Parameters
- llvm::PHINode* PN
- llvm::VPValue* V
¶void addVF(llvm::ElementCount VF)
void addVF(llvm::ElementCount VF)
Declared at: llvm/lib/Transforms/Vectorize/VPlan.h:2605
Parameters
¶void addVPValue(llvm::Value* V,
llvm::VPValue* VPV)
void addVPValue(llvm::Value* V,
llvm::VPValue* VPV)
Declared at: llvm/lib/Transforms/Vectorize/VPlan.h:2631
Parameters
- llvm::Value* V
- llvm::VPValue* VPV
¶void addVPValue(llvm::Value* V)
void addVPValue(llvm::Value* V)
Declared at: llvm/lib/Transforms/Vectorize/VPlan.h:2621
Parameters
- llvm::Value* V
¶void clearLiveOuts()
void clearLiveOuts()
Declared at: llvm/lib/Transforms/Vectorize/VPlan.h:2717
¶void disableValue2VPValue()
void disableValue2VPValue()
Description
Mark the plan to indicate that using Value2VPValue is not safe any longer, because it may be stale.
Declared at: llvm/lib/Transforms/Vectorize/VPlan.h:2603
¶void dump() const
void dump() const
Description
Dump the plan to stderr (for debugging).
Declared at: llvm/lib/Transforms/Vectorize/VPlan.h:2674
¶void execute(struct VPTransformState* State)
void execute(struct VPTransformState* State)
Description
Generate the IR code for this VPlan.
Declared at: llvm/lib/Transforms/Vectorize/VPlan.h:2573
Parameters
- struct VPTransformState* State
¶llvm::VPActiveLaneMaskPHIRecipe*
getActiveLaneMaskPhi()
llvm::VPActiveLaneMaskPHIRecipe*
getActiveLaneMaskPhi()
Description
Find and return the VPActiveLaneMaskPHIRecipe from the header - there be only one at most. If there isn't one, then return nullptr.
Declared at: llvm/lib/Transforms/Vectorize/VPlan.h:2713
¶llvm::VPCanonicalIVPHIRecipe* getCanonicalIV()
llvm::VPCanonicalIVPHIRecipe* getCanonicalIV()
Description
Returns the canonical induction recipe of the vector loop.
Declared at: llvm/lib/Transforms/Vectorize/VPlan.h:2702
¶llvm::VPBlockBase* getEntry()
llvm::VPBlockBase* getEntry()
Declared at: llvm/lib/Transforms/Vectorize/VPlan.h:2575
¶const llvm::VPBlockBase* getEntry() const
const llvm::VPBlockBase* getEntry() const
Declared at: llvm/lib/Transforms/Vectorize/VPlan.h:2576
¶const MapVector<llvm::PHINode*, llvm::VPLiveOut*>&
getLiveOuts() const
const MapVector<llvm::PHINode*, llvm::VPLiveOut*>&
getLiveOuts() const
Declared at: llvm/lib/Transforms/Vectorize/VPlan.h:2728
¶const std::string& getName() const
const std::string& getName() const
Declared at: llvm/lib/Transforms/Vectorize/VPlan.h:2609
¶llvm::VPValue* getOrAddExternalDef(llvm::Value* V)
llvm::VPValue* getOrAddExternalDef(llvm::Value* V)
Description
Get the existing or add a new external definition for \p V.
Declared at: llvm/lib/Transforms/Vectorize/VPlan.h:2614
Parameters
- llvm::Value* V
¶llvm::VPValue* getOrAddVPValue(
llvm::Value* V,
bool OverrideAllowed = false)
llvm::VPValue* getOrAddVPValue(
llvm::Value* V,
bool OverrideAllowed = false)
Description
Gets the VPValue or adds a new one (if none exists yet) for \p V. \p OverrideAllowed can be used to disable checking whether it is safe to query VPValues using IR Values.
Declared at: llvm/lib/Transforms/Vectorize/VPlan.h:2651
Parameters
- llvm::Value* V
- bool OverrideAllowed = false
¶llvm::VPValue* getOrCreateBackedgeTakenCount()
llvm::VPValue* getOrCreateBackedgeTakenCount()
Description
The backedge taken count of the original loop.
Declared at: llvm/lib/Transforms/Vectorize/VPlan.h:2592
¶llvm::VPValue* getOrCreateTripCount()
llvm::VPValue* getOrCreateTripCount()
Description
The trip count of the original loop.
Declared at: llvm/lib/Transforms/Vectorize/VPlan.h:2585
¶llvm::VPValue* getVPValue(
llvm::Value* V,
bool OverrideAllowed = false)
llvm::VPValue* getVPValue(
llvm::Value* V,
bool OverrideAllowed = false)
Description
Returns the VPValue for \p V. \p OverrideAllowed can be used to disable checking whether it is safe to query VPValues using IR Values.
Declared at: llvm/lib/Transforms/Vectorize/VPlan.h:2640
Parameters
- llvm::Value* V
- bool OverrideAllowed = false
¶const llvm::VPRegionBlock* getVectorLoopRegion()
const
const llvm::VPRegionBlock* getVectorLoopRegion()
const
Declared at: llvm/lib/Transforms/Vectorize/VPlan.h:2697
¶llvm::VPRegionBlock* getVectorLoopRegion()
llvm::VPRegionBlock* getVectorLoopRegion()
Description
Returns the VPRegionBlock of the vector loop.
Declared at: llvm/lib/Transforms/Vectorize/VPlan.h:2694
¶llvm::VPValue& getVectorTripCount()
llvm::VPValue& getVectorTripCount()
Description
The vector trip count.
Declared at: llvm/lib/Transforms/Vectorize/VPlan.h:2599
¶bool hasVF(llvm::ElementCount VF)
bool hasVF(llvm::ElementCount VF)
Declared at: llvm/lib/Transforms/Vectorize/VPlan.h:2607
Parameters
¶bool isUniformAfterVectorization(
llvm::VPValue* VPV) const
bool isUniformAfterVectorization(
llvm::VPValue* VPV) const
Description
Returns true if \p VPV is uniform after vectorization.
Declared at: llvm/lib/Transforms/Vectorize/VPlan.h:2688
Parameters
- llvm::VPValue* VPV
¶iterator_range<mapped_iterator<
llvm::Use*,
std::function<VPValue*(Value*)>>>
mapToVPValues(User::op_range Operands)
iterator_range<mapped_iterator<
llvm::Use*,
std::function<VPValue*(Value*)>>>
mapToVPValues(User::op_range Operands)
Description
Returns a range mapping the values the range \p Operands to their corresponding VPValues.
Declared at: llvm/lib/Transforms/Vectorize/VPlan.h:2680
Parameters
- User::op_range Operands
¶void prepareToExecute(
llvm::Value* TripCount,
llvm::Value* VectorTripCount,
llvm::Value* CanonicalIVStartValue,
llvm::VPTransformState& State,
bool IsEpilogueVectorization)
void prepareToExecute(
llvm::Value* TripCount,
llvm::Value* VectorTripCount,
llvm::Value* CanonicalIVStartValue,
llvm::VPTransformState& State,
bool IsEpilogueVectorization)
Description
Prepare the plan for execution, setting up the required live-in values.
Declared at: llvm/lib/Transforms/Vectorize/VPlan.h:2568
Parameters
- llvm::Value* TripCount
- llvm::Value* VectorTripCount
- llvm::Value* CanonicalIVStartValue
- llvm::VPTransformState& State
- bool IsEpilogueVectorization
¶void print(llvm::raw_ostream& O) const
void print(llvm::raw_ostream& O) const
Description
Print this VPlan to \p O.
Declared at: llvm/lib/Transforms/Vectorize/VPlan.h:2668
Parameters
¶void printDOT(llvm::raw_ostream& O) const
void printDOT(llvm::raw_ostream& O) const
Description
Print this VPlan in DOT format to \p O.
Declared at: llvm/lib/Transforms/Vectorize/VPlan.h:2671
Parameters
¶void removeLiveOut(llvm::PHINode* PN)
void removeLiveOut(llvm::PHINode* PN)
Declared at: llvm/lib/Transforms/Vectorize/VPlan.h:2723
Parameters
- llvm::PHINode* PN
¶void removeVPValueFor(llvm::Value* V)
void removeVPValueFor(llvm::Value* V)
Declared at: llvm/lib/Transforms/Vectorize/VPlan.h:2660
Parameters
- llvm::Value* V
¶llvm::VPBlockBase* setEntry(
llvm::VPBlockBase* Block)
llvm::VPBlockBase* setEntry(
llvm::VPBlockBase* Block)
Declared at: llvm/lib/Transforms/Vectorize/VPlan.h:2578
Parameters
- llvm::VPBlockBase* Block
¶void setName(const llvm::Twine& newName)
void setName(const llvm::Twine& newName)
Declared at: llvm/lib/Transforms/Vectorize/VPlan.h:2611
Parameters
- const llvm::Twine& newName
¶static void updateDominatorTree(
llvm::DominatorTree* DT,
llvm::BasicBlock* LoopLatchBB,
llvm::BasicBlock* LoopPreHeaderBB,
llvm::BasicBlock* LoopExitBB)
static void updateDominatorTree(
llvm::DominatorTree* DT,
llvm::BasicBlock* LoopLatchBB,
llvm::BasicBlock* LoopPreHeaderBB,
llvm::BasicBlock* LoopExitBB)
Description
Add to the given dominator tree the header block and every new basic block that was created between it and the latch block, inclusive.
Declared at: llvm/lib/Transforms/Vectorize/VPlan.h:2735
Parameters
- llvm::DominatorTree* DT
- llvm::BasicBlock* LoopLatchBB
- llvm::BasicBlock* LoopPreHeaderBB
- llvm::BasicBlock* LoopExitBB
¶~VPlan()
~VPlan()
Declared at: llvm/lib/Transforms/Vectorize/VPlan.h:2547