class LoopVectorizationPlanner
Declaration
class LoopVectorizationPlanner { /* full declaration omitted */ };
Description
Planner drives the vectorization process after having passed Legality checks.
Declared at: llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h:252
Member Variables
- private llvm::Loop* OrigLoop
- The loop that we evaluate.
- private llvm::LoopInfo* LI
- Loop Info analysis.
- private const llvm::TargetLibraryInfo* TLI
- Target Library Info.
- private const llvm::TargetTransformInfo* TTI
- Target Transform Info.
- private llvm::LoopVectorizationLegality* Legal
- The legality analysis.
- private llvm::LoopVectorizationCostModel& CM
- The profitability analysis.
- private llvm::InterleavedAccessInfo& IAI
- The interleaved access analysis.
- private llvm::PredicatedScalarEvolution& PSE
- private const llvm::LoopVectorizeHints& Hints
- private llvm::OptimizationRemarkEmitter* ORE
- private SmallVector<llvm::VPlanPtr, 4> VPlans
- private llvm::VPBuilder Builder
- A builder used to construct the current plan.
Method Overview
- public LoopVectorizationPlanner(llvm::Loop * L, llvm::LoopInfo * LI, const llvm::TargetLibraryInfo * TLI, const llvm::TargetTransformInfo * TTI, llvm::LoopVectorizationLegality * Legal, llvm::LoopVectorizationCostModel & CM, llvm::InterleavedAccessInfo & IAI, llvm::PredicatedScalarEvolution & PSE, const llvm::LoopVectorizeHints & Hints, llvm::OptimizationRemarkEmitter * ORE)
- private void adjustRecipesForReductions(llvm::VPBasicBlock * LatchVPBB, llvm::VPlanPtr & Plan, llvm::VPRecipeBuilder & RecipeBuilder, llvm::ElementCount MinVF)
- private llvm::VPlanPtr buildVPlan(llvm::VFRange & Range)
- private llvm::VPlanPtr buildVPlanWithVPRecipes(llvm::VFRange & Range, SmallPtrSetImpl<llvm::Instruction *> & DeadInstructions, const MapVector<llvm::Instruction *, llvm::Instruction *> & SinkAfter)
- protected void buildVPlans(llvm::ElementCount MinVF, llvm::ElementCount MaxVF)
- private void buildVPlansWithVPRecipes(llvm::ElementCount MinVF, llvm::ElementCount MaxVF)
- public void executePlan(llvm::ElementCount VF, unsigned int UF, llvm::VPlan & BestPlan, llvm::InnerLoopVectorizer & LB, llvm::DominatorTree * DT, bool IsEpilogueVectorization)
- public llvm::VPlan & getBestPlanFor(llvm::ElementCount VF) const
- public static bool getDecisionAndClampRange(const std::function<bool (ElementCount)> & Predicate, llvm::VFRange & Range)
- public bool hasPlanWithVF(llvm::ElementCount VF) const
- public Optional<llvm::VectorizationFactor> plan(llvm::ElementCount UserVF, unsigned int UserIC)
- public llvm::VectorizationFactor planInVPlanNativePath(llvm::ElementCount UserVF)
- public void printPlans(llvm::raw_ostream & O)
- public bool requiresTooManyRuntimeChecks() const
Methods
¶LoopVectorizationPlanner(
llvm::Loop* L,
llvm::LoopInfo* LI,
const llvm::TargetLibraryInfo* TLI,
const llvm::TargetTransformInfo* TTI,
llvm::LoopVectorizationLegality* Legal,
llvm::LoopVectorizationCostModel& CM,
llvm::InterleavedAccessInfo& IAI,
llvm::PredicatedScalarEvolution& PSE,
const llvm::LoopVectorizeHints& Hints,
llvm::OptimizationRemarkEmitter* ORE)
LoopVectorizationPlanner(
llvm::Loop* L,
llvm::LoopInfo* LI,
const llvm::TargetLibraryInfo* TLI,
const llvm::TargetTransformInfo* TTI,
llvm::LoopVectorizationLegality* Legal,
llvm::LoopVectorizationCostModel& CM,
llvm::InterleavedAccessInfo& IAI,
llvm::PredicatedScalarEvolution& PSE,
const llvm::LoopVectorizeHints& Hints,
llvm::OptimizationRemarkEmitter* ORE)
Declared at: llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h:286
Parameters
- llvm::Loop* L
- llvm::LoopInfo* LI
- const llvm::TargetLibraryInfo* TLI
- const llvm::TargetTransformInfo* TTI
- llvm::LoopVectorizationLegality* Legal
- llvm::LoopVectorizationCostModel& CM
- llvm::InterleavedAccessInfo& IAI
- llvm::PredicatedScalarEvolution& PSE
- const llvm::LoopVectorizeHints& Hints
- llvm::OptimizationRemarkEmitter* ORE
¶void adjustRecipesForReductions(
llvm::VPBasicBlock* LatchVPBB,
llvm::VPlanPtr& Plan,
llvm::VPRecipeBuilder& RecipeBuilder,
llvm::ElementCount MinVF)
void adjustRecipesForReductions(
llvm::VPBasicBlock* LatchVPBB,
llvm::VPlanPtr& Plan,
llvm::VPRecipeBuilder& RecipeBuilder,
llvm::ElementCount MinVF)
Declared at: llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h:366
Parameters
- llvm::VPBasicBlock* LatchVPBB
- llvm::VPlanPtr& Plan
- llvm::VPRecipeBuilder& RecipeBuilder
- llvm::ElementCount MinVF
¶llvm::VPlanPtr buildVPlan(llvm::VFRange& Range)
llvm::VPlanPtr buildVPlan(llvm::VFRange& Range)
Description
Build a VPlan according to the information gathered by Legal.
Declared at: llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h:348
Parameters
- llvm::VFRange& Range
Returns
a VPlan for vectorization factors \p Range.Start and up to \p Range.End exclusive, possibly decreasing \p Range.End.
¶llvm::VPlanPtr buildVPlanWithVPRecipes(
llvm::VFRange& Range,
SmallPtrSetImpl<llvm::Instruction*>&
DeadInstructions,
const MapVector<llvm::Instruction*,
llvm::Instruction*>&
SinkAfter)
llvm::VPlanPtr buildVPlanWithVPRecipes(
llvm::VFRange& Range,
SmallPtrSetImpl<llvm::Instruction*>&
DeadInstructions,
const MapVector<llvm::Instruction*,
llvm::Instruction*>&
SinkAfter)
Description
Build a VPlan using VPRecipes according to the information gather by Legal. This method is only used for the legacy inner loop vectorizer.
Declared at: llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h:352
Parameters
- llvm::VFRange& Range
- SmallPtrSetImpl<llvm::Instruction*>& DeadInstructions
- const MapVector<llvm::Instruction*, llvm::Instruction*>& SinkAfter
¶void buildVPlans(llvm::ElementCount MinVF,
llvm::ElementCount MaxVF)
void buildVPlans(llvm::ElementCount MinVF,
llvm::ElementCount MaxVF)
Description
Build VPlans for power-of-2 VF's between \p MinVF and \p MaxVF inclusive, according to the information gathered by Legal when it checked if it is legal to vectorize the loop.
Declared at: llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h:342
Parameters
- llvm::ElementCount MinVF
- llvm::ElementCount MaxVF
¶void buildVPlansWithVPRecipes(
llvm::ElementCount MinVF,
llvm::ElementCount MaxVF)
void buildVPlansWithVPRecipes(
llvm::ElementCount MinVF,
llvm::ElementCount MaxVF)
Description
Build VPlans for power-of-2 VF's between \p MinVF and \p MaxVF inclusive, according to the information gathered by Legal when it checked if it is legal to vectorize the loop. This method creates VPlans using VPRecipes.
Declared at: llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h:359
Parameters
- llvm::ElementCount MinVF
- llvm::ElementCount MaxVF
¶void executePlan(llvm::ElementCount VF,
unsigned int UF,
llvm::VPlan& BestPlan,
llvm::InnerLoopVectorizer& LB,
llvm::DominatorTree* DT,
bool IsEpilogueVectorization)
void executePlan(llvm::ElementCount VF,
unsigned int UF,
llvm::VPlan& BestPlan,
llvm::InnerLoopVectorizer& LB,
llvm::DominatorTree* DT,
bool IsEpilogueVectorization)
Description
Generate the IR code for the body of the vectorized loop according to the best selected \p VF, \p UF and VPlan \p BestPlan. TODO: \p IsEpilogueVectorization is needed to avoid issues due to epilogue vectorization re-using plans for both the main and epilogue vector loops. It should be removed once the re-use issue has been fixed.
Declared at: llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h:313
Parameters
- llvm::ElementCount VF
- unsigned int UF
- llvm::VPlan& BestPlan
- llvm::InnerLoopVectorizer& LB
- llvm::DominatorTree* DT
- bool IsEpilogueVectorization
¶llvm::VPlan& getBestPlanFor(
llvm::ElementCount VF) const
llvm::VPlan& getBestPlanFor(
llvm::ElementCount VF) const
Description
Return the best VPlan for \p VF.
Declared at: llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h:306
Parameters
¶static bool getDecisionAndClampRange(
const std::function<bool(ElementCount)>&
Predicate,
llvm::VFRange& Range)
static bool getDecisionAndClampRange(
const std::function<bool(ElementCount)>&
Predicate,
llvm::VFRange& Range)
Description
Test a \p Predicate on a \p Range of VF's. Return the value of applying\p Predicate on Range.Start, possibly decreasing Range.End such that the returned value holds for the entire \p Range.
Declared at: llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h:332
Parameters
- const std::function<bool(ElementCount)>& Predicate
- llvm::VFRange& Range
¶bool hasPlanWithVF(llvm::ElementCount VF) const
bool hasPlanWithVF(llvm::ElementCount VF) const
Description
Look through the existing plans and return true if we have one with all the vectorization factors in question.
Declared at: llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h:323
Parameters
¶Optional<llvm::VectorizationFactor> plan(
llvm::ElementCount UserVF,
unsigned int UserIC)
Optional<llvm::VectorizationFactor> plan(
llvm::ElementCount UserVF,
unsigned int UserIC)
Description
Plan how to best vectorize, return the best VF and its cost, or None if vectorization and interleaving should be avoided up front.
Declared at: llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h:299
Parameters
- llvm::ElementCount UserVF
- unsigned int UserIC
¶llvm::VectorizationFactor planInVPlanNativePath(
llvm::ElementCount UserVF)
llvm::VectorizationFactor planInVPlanNativePath(
llvm::ElementCount UserVF)
Description
Use the VPlan-native path to plan how to best vectorize, return the best VF and its cost.
Declared at: llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h:303
Parameters
- llvm::ElementCount UserVF
¶void printPlans(llvm::raw_ostream& O)
void printPlans(llvm::raw_ostream& O)
Declared at: llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h:318
Parameters
¶bool requiresTooManyRuntimeChecks() const
bool requiresTooManyRuntimeChecks() const
Description
Check if the number of runtime checks exceeds the threshold.
Declared at: llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h:336