LLVM 22.0.0git
|
Class that provides utilities for VPBlockBases in VPlan. More...
#include "Transforms/Vectorize/VPlanUtils.h"
Public Member Functions | |
VPBlockUtils ()=delete |
Static Public Member Functions | |
static void | insertBlockAfter (VPBlockBase *NewBlock, VPBlockBase *BlockPtr) |
Insert disconnected VPBlockBase NewBlock after BlockPtr . | |
static void | insertBlockBefore (VPBlockBase *NewBlock, VPBlockBase *BlockPtr) |
Insert disconnected block NewBlock before Blockptr . | |
static void | insertTwoBlocksAfter (VPBlockBase *IfTrue, VPBlockBase *IfFalse, VPBlockBase *BlockPtr) |
Insert disconnected VPBlockBases IfTrue and IfFalse after BlockPtr . | |
static void | connectBlocks (VPBlockBase *From, VPBlockBase *To, unsigned PredIdx=-1u, unsigned SuccIdx=-1u) |
Connect VPBlockBases From and To bi-directionally. | |
static void | disconnectBlocks (VPBlockBase *From, VPBlockBase *To) |
Disconnect VPBlockBases From and To bi-directionally. | |
static void | reassociateBlocks (VPBlockBase *Old, VPBlockBase *New) |
Reassociate all the blocks connected to Old so that they now point to New . | |
template<typename BlockTy, typename T> | |
static auto | blocksOnly (const T &Range) |
Return an iterator range over Range which only includes BlockTy blocks. | |
static void | insertOnEdge (VPBlockBase *From, VPBlockBase *To, VPBlockBase *BlockPtr) |
Inserts BlockPtr on the edge between From and To . | |
static bool | isHeader (const VPBlockBase *VPB, const VPDominatorTree &VPDT) |
Returns true if VPB is a loop header, based on regions or VPDT in their absence. | |
static bool | isLatch (const VPBlockBase *VPB, const VPDominatorTree &VPDT) |
Returns true if VPB is a loop latch, using isHeader(). |
Class that provides utilities for VPBlockBases in VPlan.
Definition at line 122 of file VPlanUtils.h.
|
delete |
Return an iterator range over Range
which only includes BlockTy
blocks.
The accesses are casted to BlockTy
.
Definition at line 228 of file VPlanUtils.h.
References llvm::Block, llvm::cast(), llvm::Filter, llvm::isa(), llvm::make_filter_range(), llvm::map_range(), Range, and T.
Referenced by addReplicateRegions(), llvm::calculateRegisterUsageForPlan(), llvm::VPlanTransforms::canonicalizeEVLLoops(), llvm::collectEphemeralRecipesForVPlan(), llvm::VPlanTransforms::convertToAbstractRecipes(), llvm::VPlanTransforms::convertToConcreteRecipes(), llvm::VPlan::cost(), llvm::VPlanTransforms::cse(), llvm::VPlanTransforms::dissolveLoopRegions(), llvm::VPlanTransforms::dropPoisonGeneratingRecipes(), llvm::LoopVectorizationPlanner::emitInvalidCostRemarks(), llvm::InnerLoopVectorizer::fixNonInductionPHIs(), hasReplicatorRegion(), llvm::VPlanTransforms::introduceMasksAndLinearize(), licm(), llvm::VPlanTransforms::materializeBuildVectors(), mergeBlocksIntoPredecessors(), mergeReplicateRegionsIntoSuccessors(), narrowToSingleScalarRecipes(), planContainsAdditionalSimplifications(), remapOperands(), llvm::VPlanTransforms::removeBranchOnConst(), llvm::VPlanTransforms::removeDeadRecipes(), llvm::VPlanTransforms::replicateByVF(), llvm::LoopVectorizationPlanner::selectInterleaveCount(), simplifyBlends(), llvm::VPlanTransforms::simplifyRecipes(), sinkScalarOperands(), transformRecipestoEVLRecipes(), llvm::VPlanTransforms::truncateToMinimalBitwidths(), llvm::VPlanTransforms::tryToConvertVPInstructionsToVPRecipes(), llvm::VPlanTransforms::unrollByUF(), and willGenerateVectors().
|
inlinestatic |
Connect VPBlockBases From
and To
bi-directionally.
If PredIdx
is -1, append From
to the predecessors of To
, otherwise set To's
predecessor at PredIdx
to From
. If SuccIdx
is -1, append To
to the successors of From
, otherwise set From's
successor at SuccIdx
to To
. Both VPBlockBases must have the same parent, which can be null. Both VPBlockBases can be already connected to other VPBlockBases.
Definition at line 187 of file VPlanUtils.h.
References assert(), llvm::VPBlockBase::getNumSuccessors(), llvm::VPBlockBase::getParent(), llvm::VPBlockBase::getPredecessors(), and llvm::VPBlockBase::getSuccessors().
Referenced by addInitialSkeleton(), llvm::VPlanTransforms::attachCheckBlock(), createLoopRegion(), createReplicateRegion(), llvm::VPRegionBlock::dissolveToCFGLoop(), llvm::VPlanTransforms::handleUncountableEarlyExit(), insertBlockAfter(), insertBlockBefore(), insertOnEdge(), llvm::EpilogueVectorizerMainLoop::introduceCheckBlockInVPlan(), llvm::VPlanTransforms::introduceMasksAndLinearize(), mergeBlocksIntoPredecessors(), mergeReplicateRegionsIntoSuccessors(), and simplifyBranchConditionForVFAndUF().
|
inlinestatic |
Disconnect VPBlockBases From
and To
bi-directionally.
Remove To
from the successors of From
and From
from the predecessors of To
.
Definition at line 206 of file VPlanUtils.h.
References assert().
Referenced by createLoopRegion(), llvm::VPRegionBlock::dissolveToCFGLoop(), llvm::VPlanTransforms::handleEarlyExits(), llvm::VPlanTransforms::introduceMasksAndLinearize(), mergeBlocksIntoPredecessors(), mergeReplicateRegionsIntoSuccessors(), llvm::VPlanTransforms::removeBranchOnConst(), and simplifyBranchConditionForVFAndUF().
|
inlinestatic |
Insert disconnected VPBlockBase NewBlock
after BlockPtr
.
Add NewBlock
as successor of BlockPtr
and BlockPtr
as predecessor of NewBlock
, and propagate BlockPtr
parent to NewBlock
. BlockPtr's
successors are moved from BlockPtr
to NewBlock
. NewBlock
must have neither successors nor predecessors.
Definition at line 131 of file VPlanUtils.h.
References assert(), llvm::VPBlockBase::clearSuccessors(), connectBlocks(), llvm::SmallVectorTemplateCommon< T, typename >::empty(), llvm::VPBlockBase::getParent(), llvm::VPBlockBase::getPredecessors(), llvm::VPBlockBase::getSuccessors(), llvm::VPBlockBase::setParent(), and llvm::VPBlockBase::successors().
Referenced by addInitialSkeleton(), and llvm::VPBasicBlock::splitAt().
|
inlinestatic |
Insert disconnected block NewBlock
before Blockptr
.
First disconnects all predecessors of BlockPtr
and connects them to NewBlock
. Add NewBlock
as predecessor of BlockPtr
and BlockPtr
as successor of NewBlock
.
Definition at line 149 of file VPlanUtils.h.
References assert(), llvm::VPBlockBase::clearPredecessors(), connectBlocks(), llvm::SmallVectorTemplateCommon< T, typename >::empty(), llvm::VPBlockBase::getParent(), llvm::VPBlockBase::getPredecessors(), llvm::VPBlockBase::getSuccessors(), llvm::VPBlockBase::predecessors(), llvm::VPBlockBase::setParent(), and llvm::to_vector().
|
inlinestatic |
Inserts BlockPtr
on the edge between From
and To
.
That is, update From's
successor to To
to point to BlockPtr
and To's
predecessor from From
to BlockPtr
. From
and To
are added to BlockPtr's
predecessors and successors respectively. There must be a single edge between From
and To
.
Definition at line 249 of file VPlanUtils.h.
References connectBlocks(), llvm::VPBlockBase::getIndexForPredecessor(), and llvm::VPBlockBase::getIndexForSuccessor().
Referenced by addInitialSkeleton(), addReplicateRegions(), llvm::VPlanTransforms::attachCheckBlock(), createLoopRegion(), llvm::VPlanTransforms::handleUncountableEarlyExit(), and llvm::EpilogueVectorizerMainLoop::introduceCheckBlockInVPlan().
|
inlinestatic |
Insert disconnected VPBlockBases IfTrue
and IfFalse
after BlockPtr
.
Add IfTrue
and IfFalse
as succesors of BlockPtr
and BlockPtr
as predecessor of IfTrue
and IfFalse
. Propagate BlockPtr
parent to IfTrue
and IfFalse
. BlockPtr
must have no successors and IfTrue
and IfFalse
must have neither successors nor predecessors.
Definition at line 168 of file VPlanUtils.h.
References assert(), llvm::SmallVectorTemplateCommon< T, typename >::empty(), llvm::VPBlockBase::getParent(), llvm::VPBlockBase::getSuccessors(), llvm::VPBlockBase::setParent(), llvm::VPBlockBase::setPredecessors(), and llvm::VPBlockBase::setTwoSuccessors().
Referenced by createReplicateRegion().
|
static |
Returns true if VPB
is a loop header, based on regions or VPDT
in their absence.
Definition at line 220 of file VPlan.cpp.
References llvm::DominatorTreeBase< NodeT, IsPostDom >::dominates(), llvm::dyn_cast(), llvm::VPBlockBase::getPredecessors(), and llvm::SmallVectorTemplateCommon< T, typename >::size().
Referenced by llvm::VPBasicBlock::connectToPredecessors(), llvm::VPBasicBlock::execute(), llvm::vputils::getFirstLoopHeader(), and isLatch().
|
static |
Returns true if VPB
is a loop latch, using isHeader().
Definition at line 237 of file VPlan.cpp.
References llvm::VPBlockBase::getNumSuccessors(), llvm::VPBlockBase::getSuccessors(), and isHeader().
Referenced by llvm::VPBasicBlock::execute().
|
inlinestatic |
Reassociate all the blocks connected to Old
so that they now point to New
.
Definition at line 214 of file VPlanUtils.h.
References llvm::VPBlockBase::clearPredecessors(), llvm::VPBlockBase::clearSuccessors(), llvm::VPBlockBase::getPredecessors(), llvm::VPBlockBase::getSuccessors(), and llvm::to_vector().
Referenced by llvm::EpilogueVectorizerEpilogueLoop::emitMinimumVectorEpilogueIterCountCheck(), and replaceVPBBWithIRVPBB().