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:185

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)
  • protected void buildVPlans(unsigned int MinVF, unsigned int MaxVF)
  • protected void collectTriviallyDeadInstructions(SmallPtrSetImpl<llvm::Instruction *> & DeadInstructions)
  • public void executePlan(llvm::InnerLoopVectorizer & LB, llvm::DominatorTree * DT)
  • public static bool getDecisionAndClampRange(const std::function<bool (unsigned int)> & Predicate, llvm::VFRange & Range)
  • public Optional<llvm::VectorizationFactor> plan(unsigned int UserVF)
  • public llvm::VectorizationFactor planInVPlanNativePath(unsigned int UserVF)
  • public void printPlans(llvm::raw_ostream & O)
  • public void setBestPlan(unsigned int VF, unsigned int UF)

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)

Declared at: llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h:228

Parameters

llvm::Loop* L
llvm::LoopInfo* LI
const llvm::TargetLibraryInfo* TLI
const llvm::TargetTransformInfo* TTI
llvm::LoopVectorizationLegality* Legal
llvm::LoopVectorizationCostModel& CM
llvm::InterleavedAccessInfo& IAI

void buildVPlans(unsigned int MinVF,
                 unsigned int 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:272

Parameters

unsigned int MinVF
unsigned int MaxVF

void collectTriviallyDeadInstructions(
    SmallPtrSetImpl<llvm::Instruction*>&
        DeadInstructions)

Description

Collect the instructions from the original loop that would be trivially dead in the vectorized loop if generated.

Declared at: llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h:266

Parameters

SmallPtrSetImpl<llvm::Instruction*>& DeadInstructions

void executePlan(llvm::InnerLoopVectorizer& LB,
                 llvm::DominatorTree* DT)

Description

Generate the IR code for the body of the vectorized loop according to the best selected VPlan.

Declared at: llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h:249

Parameters

llvm::InnerLoopVectorizer& LB
llvm::DominatorTree* DT

static bool getDecisionAndClampRange(
    const std::function<bool(unsigned int)>&
        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:260

Parameters

const std::function<bool(unsigned int)>& Predicate
llvm::VFRange& Range

Optional<llvm::VectorizationFactor> plan(
    unsigned int UserVF)

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:238

Parameters

unsigned int UserVF

llvm::VectorizationFactor planInVPlanNativePath(
    unsigned int 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:242

Parameters

unsigned int UserVF

void printPlans(llvm::raw_ostream& O)

Declared at: llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h:251

Parameters

llvm::raw_ostream& O

void setBestPlan(unsigned int VF, unsigned int UF)

Description

Finalize the best decision and dispose of all other VPlans.

Declared at: llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h:245

Parameters

unsigned int VF
unsigned int UF