LLVM 22.0.0git
|
InnerLoopVectorizer vectorizes loops which contain only one basic block to a specified vectorization factor (VF). More...
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 BasicBlock * | createVectorizedLoopSkeleton () |
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 . | |
Value * | getTripCount () 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 | |
BasicBlock * | createScalarPreheader (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 | |
Loop * | OrigLoop |
The original loop. | |
PredicatedScalarEvolution & | PSE |
A wrapper around ScalarEvolution used to add runtime SCEV checks. | |
LoopInfo * | LI |
Loop Info. | |
DominatorTree * | DT |
Dominator Tree. | |
const TargetTransformInfo * | TTI |
Target Transform Info. | |
AssumptionCache * | AC |
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. | |
Value * | TripCount = nullptr |
Trip count of the original loop. | |
LoopVectorizationCostModel * | Cost |
The profitablity analysis. | |
BlockFrequencyInfo * | BFI |
BFI and PSI are used to check for profile guided size optimizations. | |
ProfileSummaryInfo * | PSI |
GeneratedRTChecks & | RTChecks |
Structure to hold information about generated runtime checks, responsible for cleaning the checks, if vectorization turns out unprofitable. | |
VPlan & | Plan |
VPBasicBlock * | VectorPHVPBB |
The vector preheader block of Plan , used as target for check blocks introduced during skeleton creation. |
Friends | |
class | LoopVectorizationPlanner |
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 489 of file LoopVectorize.cpp.
|
inline |
Definition at line 491 of file LoopVectorize.cpp.
References AC, BFI, Builder, llvm::cast(), Cost, DT, LI, OrigLoop, Plan, PSE, PSI, RTChecks, TTI, UF, VectorPHVPBB, and VF.
Referenced by llvm::InnerLoopAndEpilogueVectorizer::InnerLoopAndEpilogueVectorizer().
|
virtualdefault |
|
protected |
Create and return a new IR basic block for the scalar preheader whose name is prefixed with Prefix
.
Definition at line 2365 of file LoopVectorize.cpp.
References assert(), Cost, DT, llvm::BasicBlock::getTerminator(), LI, OrigLoop, llvm::SplitBlock(), and VF.
Referenced by llvm::EpilogueVectorizerEpilogueLoop::createVectorizedLoopSkeleton(), llvm::EpilogueVectorizerMainLoop::createVectorizedLoopSkeleton(), and 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::EpilogueVectorizerEpilogueLoop, and llvm::EpilogueVectorizerMainLoop.
Definition at line 2417 of file LoopVectorize.cpp.
References createScalarPreheader(), and llvm::BasicBlock::getSinglePredecessor().
Referenced by llvm::LoopVectorizationPlanner::executePlan().
void InnerLoopVectorizer::fixNonInductionPHIs | ( | VPTransformState & | State | ) |
Fix the non-induction PHIs in Plan
.
Definition at line 2563 of file LoopVectorize.cpp.
References llvm::PHINode::addIncoming(), llvm::VPBlockUtils::blocksOnly(), Builder, llvm::cast(), llvm::dyn_cast(), llvm::VPPhiAccessors::incoming_values_and_blocks(), P, Plan, and llvm::vp_depth_first_shallow().
Referenced by fixVectorizedLoop().
void InnerLoopVectorizer::fixVectorizedLoop | ( | VPTransformState & | State | ) |
Fix the vectorized code, taking care of header phi's, and more.
Definition at line 2546 of file LoopVectorize.cpp.
References cse(), fixNonInductionPHIs(), and llvm::vputils::getFirstLoopHeader().
Referenced by llvm::LoopVectorizationPlanner::executePlan().
|
inline |
Returns the original loop trip count.
Definition at line 519 of file LoopVectorize.cpp.
References TripCount.
Referenced by llvm::EpilogueVectorizerMainLoop::createIterationCountCheck(), llvm::EpilogueVectorizerMainLoop::emitIterationCountCheck(), llvm::LoopVectorizationPlanner::executePlan(), and llvm::LoopVectorizePass::processLoop().
|
inlineprotectedvirtual |
Reimplemented in llvm::EpilogueVectorizerEpilogueLoop, and llvm::EpilogueVectorizerMainLoop.
Definition at line 536 of file LoopVectorize.cpp.
Referenced by llvm::LoopVectorizationPlanner::executePlan().
|
inlineprotectedvirtual |
Allow subclasses to override and print debug traces before/after vplan execution, when trace information is requested.
Reimplemented in llvm::EpilogueVectorizerEpilogueLoop, and llvm::EpilogueVectorizerMainLoop.
Definition at line 535 of file LoopVectorize.cpp.
Referenced by llvm::LoopVectorizationPlanner::executePlan().
|
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 524 of file LoopVectorize.cpp.
References TripCount.
Referenced by llvm::LoopVectorizationPlanner::executePlan(), and llvm::LoopVectorizePass::processLoop().
|
friend |
Definition at line 527 of file LoopVectorize.cpp.
References LoopVectorizationPlanner.
Referenced by LoopVectorizationPlanner.
|
protected |
Assumption Cache.
Definition at line 556 of file LoopVectorize.cpp.
Referenced by llvm::EpilogueVectorizerEpilogueLoop::EpilogueVectorizerEpilogueLoop(), llvm::EpilogueVectorizerMainLoop::EpilogueVectorizerMainLoop(), llvm::LoopVectorizationPlanner::executePlan(), llvm::InnerLoopAndEpilogueVectorizer::InnerLoopAndEpilogueVectorizer(), and InnerLoopVectorizer().
|
protected |
BFI and PSI are used to check for profile guided size optimizations.
Definition at line 578 of file LoopVectorize.cpp.
Referenced by llvm::EpilogueVectorizerEpilogueLoop::EpilogueVectorizerEpilogueLoop(), llvm::EpilogueVectorizerMainLoop::EpilogueVectorizerMainLoop(), llvm::InnerLoopAndEpilogueVectorizer::InnerLoopAndEpilogueVectorizer(), and InnerLoopVectorizer().
|
protected |
The builder that we use.
Definition at line 567 of file LoopVectorize.cpp.
Referenced by llvm::EpilogueVectorizerMainLoop::createIterationCountCheck(), llvm::EpilogueVectorizerEpilogueLoop::emitMinimumVectorEpilogueIterCountCheck(), llvm::LoopVectorizationPlanner::executePlan(), fixNonInductionPHIs(), and InnerLoopVectorizer().
|
protected |
The profitablity analysis.
Definition at line 575 of file LoopVectorize.cpp.
Referenced by createScalarPreheader(), and InnerLoopVectorizer().
|
protected |
Dominator Tree.
Definition at line 550 of file LoopVectorize.cpp.
Referenced by createScalarPreheader(), llvm::EpilogueVectorizerEpilogueLoop::createVectorizedLoopSkeleton(), llvm::EpilogueVectorizerEpilogueLoop::EpilogueVectorizerEpilogueLoop(), llvm::EpilogueVectorizerMainLoop::EpilogueVectorizerMainLoop(), llvm::InnerLoopAndEpilogueVectorizer::InnerLoopAndEpilogueVectorizer(), and InnerLoopVectorizer().
|
protected |
Loop Info.
Definition at line 547 of file LoopVectorize.cpp.
Referenced by createScalarPreheader(), llvm::EpilogueVectorizerEpilogueLoop::createVectorizedLoopSkeleton(), llvm::EpilogueVectorizerMainLoop::emitIterationCountCheck(), llvm::EpilogueVectorizerEpilogueLoop::EpilogueVectorizerEpilogueLoop(), llvm::EpilogueVectorizerMainLoop::EpilogueVectorizerMainLoop(), llvm::InnerLoopAndEpilogueVectorizer::InnerLoopAndEpilogueVectorizer(), and InnerLoopVectorizer().
|
protected |
The original loop.
Definition at line 539 of file LoopVectorize.cpp.
Referenced by llvm::EpilogueVectorizerMainLoop::createIterationCountCheck(), createScalarPreheader(), llvm::EpilogueVectorizerMainLoop::emitIterationCountCheck(), llvm::EpilogueVectorizerEpilogueLoop::EpilogueVectorizerEpilogueLoop(), llvm::EpilogueVectorizerMainLoop::EpilogueVectorizerMainLoop(), llvm::InnerLoopAndEpilogueVectorizer::InnerLoopAndEpilogueVectorizer(), InnerLoopVectorizer(), llvm::EpilogueVectorizerEpilogueLoop::printDebugTracesAtEnd(), and llvm::EpilogueVectorizerMainLoop::printDebugTracesAtEnd().
|
protected |
Definition at line 585 of file LoopVectorize.cpp.
Referenced by llvm::EpilogueVectorizerEpilogueLoop::emitMinimumVectorEpilogueIterCountCheck(), llvm::EpilogueVectorizerEpilogueLoop::EpilogueVectorizerEpilogueLoop(), llvm::EpilogueVectorizerMainLoop::EpilogueVectorizerMainLoop(), fixNonInductionPHIs(), llvm::InnerLoopAndEpilogueVectorizer::InnerLoopAndEpilogueVectorizer(), InnerLoopVectorizer(), and llvm::EpilogueVectorizerMainLoop::introduceCheckBlockInVPlan().
|
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 544 of file LoopVectorize.cpp.
Referenced by llvm::EpilogueVectorizerMainLoop::createIterationCountCheck(), llvm::EpilogueVectorizerEpilogueLoop::EpilogueVectorizerEpilogueLoop(), llvm::EpilogueVectorizerMainLoop::EpilogueVectorizerMainLoop(), llvm::InnerLoopAndEpilogueVectorizer::InnerLoopAndEpilogueVectorizer(), and InnerLoopVectorizer().
|
protected |
|
protected |
Structure to hold information about generated runtime checks, responsible for cleaning the checks, if vectorization turns out unprofitable.
Definition at line 583 of file LoopVectorize.cpp.
Referenced by llvm::EpilogueVectorizerEpilogueLoop::createVectorizedLoopSkeleton(), llvm::LoopVectorizationPlanner::executePlan(), and InnerLoopVectorizer().
|
protected |
Trip count of the original loop.
Definition at line 572 of file LoopVectorize.cpp.
Referenced by llvm::EpilogueVectorizerEpilogueLoop::EpilogueVectorizerEpilogueLoop(), getTripCount(), and setTripCount().
|
protected |
Target Transform Info.
Definition at line 553 of file LoopVectorize.cpp.
Referenced by llvm::InnerLoopAndEpilogueVectorizer::InnerLoopAndEpilogueVectorizer(), and InnerLoopVectorizer().
|
protected |
The vectorization unroll factor to use.
Each scalar is vectorized to this many different vector instructions.
Definition at line 564 of file LoopVectorize.cpp.
Referenced by llvm::EpilogueVectorizerMainLoop::createIterationCountCheck(), and InnerLoopVectorizer().
|
protected |
The vector preheader block of Plan
, used as target for check blocks introduced during skeleton creation.
Definition at line 589 of file LoopVectorize.cpp.
Referenced by llvm::EpilogueVectorizerEpilogueLoop::createVectorizedLoopSkeleton(), llvm::EpilogueVectorizerMainLoop::emitIterationCountCheck(), InnerLoopVectorizer(), and llvm::EpilogueVectorizerMainLoop::introduceCheckBlockInVPlan().
|
protected |
The vectorization SIMD factor to use.
Each vector will have this many vector elements.
Definition at line 560 of file LoopVectorize.cpp.
Referenced by llvm::EpilogueVectorizerMainLoop::createIterationCountCheck(), createScalarPreheader(), and InnerLoopVectorizer().