LLVM 22.0.0git
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
llvm::InnerLoopVectorizer Class Reference

InnerLoopVectorizer vectorizes loops which contain only one basic block to a specified vectorization factor (VF). More...

Inheritance diagram for llvm::InnerLoopVectorizer:
[legend]

Public Member Functions

 InnerLoopVectorizer (Loop *OrigLoop, PredicatedScalarEvolution &PSE, LoopInfo *LI, DominatorTree *DT, const TargetTransformInfo *TTI, AssumptionCache *AC, ElementCount VecWidth, unsigned UnrollFactor, LoopVectorizationCostModel *CM, BlockFrequencyInfo *BFI, ProfileSummaryInfo *PSI, GeneratedRTChecks &RTChecks, VPlan &Plan)
 
virtual ~InnerLoopVectorizer ()=default
 
virtual BasicBlockcreateVectorizedLoopSkeleton ()
 Creates a basic block for the scalar preheader.
 
void fixVectorizedLoop (VPTransformState &State)
 Fix the vectorized code, taking care of header phi's, and more.
 
void fixNonInductionPHIs (VPTransformState &State)
 Fix the non-induction PHIs in Plan.
 
ValuegetTripCount () const
 Returns the original loop trip count.
 
void setTripCount (Value *TC)
 Used to set the trip count after ILV's construction and after the preheader block has been executed.
 

Protected Member Functions

BasicBlockcreateScalarPreheader (StringRef Prefix)
 Create and return a new IR basic block for the scalar preheader whose name is prefixed with Prefix.
 
virtual void printDebugTracesAtStart ()
 Allow subclasses to override and print debug traces before/after vplan execution, when trace information is requested.
 
virtual void printDebugTracesAtEnd ()
 

Protected Attributes

LoopOrigLoop
 The original loop.
 
PredicatedScalarEvolutionPSE
 A wrapper around ScalarEvolution used to add runtime SCEV checks.
 
LoopInfoLI
 Loop Info.
 
DominatorTreeDT
 Dominator Tree.
 
const TargetTransformInfoTTI
 Target Transform Info.
 
AssumptionCacheAC
 Assumption Cache.
 
ElementCount VF
 The vectorization SIMD factor to use.
 
unsigned UF
 The vectorization unroll factor to use.
 
IRBuilder Builder
 The builder that we use.
 
BasicBlockLoopVectorPreHeader = nullptr
 The vector-loop preheader.
 
ValueTripCount = nullptr
 Trip count of the original loop.
 
LoopVectorizationCostModelCost
 The profitablity analysis.
 
BlockFrequencyInfoBFI
 BFI and PSI are used to check for profile guided size optimizations.
 
ProfileSummaryInfoPSI
 
GeneratedRTChecks & RTChecks
 Structure to hold information about generated runtime checks, responsible for cleaning the checks, if vectorization turns out unprofitable.
 
VPlanPlan
 
VPBasicBlockVectorPHVPBB
 The vector preheader block of Plan, used as target for check blocks introduced during skeleton creation.
 

Friends

class LoopVectorizationPlanner
 

Detailed Description

InnerLoopVectorizer vectorizes loops which contain only one basic block to a specified vectorization factor (VF).

This class performs the widening of scalars into vectors, or multiple scalars. This class also implements the following features:

Definition at line 498 of file LoopVectorize.cpp.

Constructor & Destructor Documentation

◆ InnerLoopVectorizer()

llvm::InnerLoopVectorizer::InnerLoopVectorizer ( Loop OrigLoop,
PredicatedScalarEvolution PSE,
LoopInfo LI,
DominatorTree DT,
const TargetTransformInfo TTI,
AssumptionCache AC,
ElementCount  VecWidth,
unsigned  UnrollFactor,
LoopVectorizationCostModel CM,
BlockFrequencyInfo BFI,
ProfileSummaryInfo PSI,
GeneratedRTChecks &  RTChecks,
VPlan Plan 
)
inline

Definition at line 500 of file LoopVectorize.cpp.

◆ ~InnerLoopVectorizer()

virtual llvm::InnerLoopVectorizer::~InnerLoopVectorizer ( )
virtualdefault

Member Function Documentation

◆ createScalarPreheader()

BasicBlock * InnerLoopVectorizer::createScalarPreheader ( StringRef  Prefix)
protected

◆ createVectorizedLoopSkeleton()

BasicBlock * InnerLoopVectorizer::createVectorizedLoopSkeleton ( )
virtual

Creates a basic block for the scalar preheader.

Both EpilogueVectorizerMainLoop and EpilogueVectorizerEpilogueLoop overwrite the method to create additional blocks and checks needed for epilogue vectorization.

Reimplemented in llvm::EpilogueVectorizerMainLoop, and llvm::EpilogueVectorizerEpilogueLoop.

Definition at line 2428 of file LoopVectorize.cpp.

References createScalarPreheader(), and llvm::BasicBlock::getSinglePredecessor().

Referenced by llvm::LoopVectorizationPlanner::executePlan().

◆ fixNonInductionPHIs()

void InnerLoopVectorizer::fixNonInductionPHIs ( VPTransformState State)

◆ fixVectorizedLoop()

void InnerLoopVectorizer::fixVectorizedLoop ( VPTransformState State)

◆ getTripCount()

Value * llvm::InnerLoopVectorizer::getTripCount ( ) const
inline

◆ printDebugTracesAtEnd()

virtual void llvm::InnerLoopVectorizer::printDebugTracesAtEnd ( )
inlineprotectedvirtual

◆ printDebugTracesAtStart()

virtual void llvm::InnerLoopVectorizer::printDebugTracesAtStart ( )
inlineprotectedvirtual

Allow subclasses to override and print debug traces before/after vplan execution, when trace information is requested.

Reimplemented in llvm::EpilogueVectorizerMainLoop, and llvm::EpilogueVectorizerEpilogueLoop.

Definition at line 544 of file LoopVectorize.cpp.

Referenced by llvm::LoopVectorizationPlanner::executePlan().

◆ setTripCount()

void llvm::InnerLoopVectorizer::setTripCount ( Value TC)
inline

Used to set the trip count after ILV's construction and after the preheader block has been executed.

Note that this always holds the trip count of the original loop for both main loop and epilogue vectorization.

Definition at line 533 of file LoopVectorize.cpp.

References TripCount.

Referenced by llvm::LoopVectorizationPlanner::executePlan(), and llvm::LoopVectorizePass::processLoop().

Friends And Related Function Documentation

◆ LoopVectorizationPlanner

friend class LoopVectorizationPlanner
friend

Definition at line 536 of file LoopVectorize.cpp.

Member Data Documentation

◆ AC

AssumptionCache* llvm::InnerLoopVectorizer::AC
protected

Assumption Cache.

Definition at line 565 of file LoopVectorize.cpp.

Referenced by llvm::LoopVectorizationPlanner::executePlan().

◆ BFI

BlockFrequencyInfo* llvm::InnerLoopVectorizer::BFI
protected

BFI and PSI are used to check for profile guided size optimizations.

Definition at line 590 of file LoopVectorize.cpp.

◆ Builder

IRBuilder llvm::InnerLoopVectorizer::Builder
protected

◆ Cost

LoopVectorizationCostModel* llvm::InnerLoopVectorizer::Cost
protected

The profitablity analysis.

Definition at line 587 of file LoopVectorize.cpp.

◆ DT

DominatorTree* llvm::InnerLoopVectorizer::DT
protected

◆ LI

LoopInfo* llvm::InnerLoopVectorizer::LI
protected

◆ LoopVectorPreHeader

BasicBlock* llvm::InnerLoopVectorizer::LoopVectorPreHeader = nullptr
protected

◆ OrigLoop

Loop* llvm::InnerLoopVectorizer::OrigLoop
protected

◆ Plan

VPlan& llvm::InnerLoopVectorizer::Plan
protected

◆ PSE

PredicatedScalarEvolution& llvm::InnerLoopVectorizer::PSE
protected

A wrapper around ScalarEvolution used to add runtime SCEV checks.

Applies dynamic knowledge to simplify SCEV expressions and converts them to a more usable form.

Definition at line 553 of file LoopVectorize.cpp.

Referenced by llvm::EpilogueVectorizerMainLoop::createIterationCountCheck().

◆ PSI

ProfileSummaryInfo* llvm::InnerLoopVectorizer::PSI
protected

Definition at line 591 of file LoopVectorize.cpp.

◆ RTChecks

GeneratedRTChecks& llvm::InnerLoopVectorizer::RTChecks
protected

Structure to hold information about generated runtime checks, responsible for cleaning the checks, if vectorization turns out unprofitable.

Definition at line 595 of file LoopVectorize.cpp.

Referenced by llvm::EpilogueVectorizerEpilogueLoop::createVectorizedLoopSkeleton(), and llvm::LoopVectorizationPlanner::executePlan().

◆ TripCount

Value* llvm::InnerLoopVectorizer::TripCount = nullptr
protected

Trip count of the original loop.

Definition at line 584 of file LoopVectorize.cpp.

Referenced by llvm::EpilogueVectorizerEpilogueLoop::EpilogueVectorizerEpilogueLoop(), getTripCount(), and setTripCount().

◆ TTI

const TargetTransformInfo* llvm::InnerLoopVectorizer::TTI
protected

Target Transform Info.

Definition at line 562 of file LoopVectorize.cpp.

◆ UF

unsigned llvm::InnerLoopVectorizer::UF
protected

The vectorization unroll factor to use.

Each scalar is vectorized to this many different vector instructions.

Definition at line 573 of file LoopVectorize.cpp.

Referenced by llvm::EpilogueVectorizerMainLoop::createIterationCountCheck(), and fixVectorizedLoop().

◆ VectorPHVPBB

VPBasicBlock* llvm::InnerLoopVectorizer::VectorPHVPBB
protected

The vector preheader block of Plan, used as target for check blocks introduced during skeleton creation.

Definition at line 601 of file LoopVectorize.cpp.

Referenced by llvm::EpilogueVectorizerEpilogueLoop::createVectorizedLoopSkeleton(), llvm::EpilogueVectorizerMainLoop::emitIterationCountCheck(), and llvm::EpilogueVectorizerMainLoop::introduceCheckBlockInVPlan().

◆ VF

ElementCount llvm::InnerLoopVectorizer::VF
protected

The vectorization SIMD factor to use.

Each vector will have this many vector elements.

Definition at line 569 of file LoopVectorize.cpp.

Referenced by llvm::EpilogueVectorizerMainLoop::createIterationCountCheck(), createScalarPreheader(), and fixVectorizedLoop().


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