|
LLVM 23.0.0git
|
VPlan models a candidate for vectorization, encoding various decisions take to produce efficient output IR, including which branches, basic-blocks and output IR instructions to generate, and their cost. More...
#include "Transforms/Vectorize/VPlan.h"
Public Member Functions | |
| VPlan (Loop *L) | |
Construct a VPlan for L. | |
| VPlan (BasicBlock *ScalarHeaderBB) | |
Construct a VPlan with a new VPBasicBlock as entry, a VPIRBasicBlock wrapping ScalarHeaderBB and a trip count of TC. | |
| LLVM_ABI_FOR_TEST | ~VPlan () |
| void | setEntry (VPBasicBlock *VPBB) |
| void | execute (VPTransformState *State) |
| Generate the IR code for this VPlan. | |
| InstructionCost | cost (ElementCount VF, VPCostContext &Ctx) |
| Return the cost of this plan. | |
| VPBasicBlock * | getEntry () |
| const VPBasicBlock * | getEntry () const |
| VPBasicBlock * | getVectorPreheader () |
| Returns the preheader of the vector loop region, if one exists, or null otherwise. | |
| LLVM_ABI_FOR_TEST VPRegionBlock * | getVectorLoopRegion () |
| Returns the VPRegionBlock of the vector loop. | |
| LLVM_ABI_FOR_TEST const VPRegionBlock * | getVectorLoopRegion () const |
| VPBasicBlock * | getMiddleBlock () |
| Returns the 'middle' block of the plan, that is the block that selects whether to execute the scalar tail loop or the exit block from the loop latch. | |
| const VPBasicBlock * | getMiddleBlock () const |
| VPBasicBlock * | getScalarPreheader () const |
| Return the VPBasicBlock for the preheader of the scalar loop. | |
| VPIRBasicBlock * | getScalarHeader () const |
| Return the VPIRBasicBlock wrapping the header of the scalar loop. | |
| ArrayRef< VPIRBasicBlock * > | getExitBlocks () const |
| Return an ArrayRef containing VPIRBasicBlocks wrapping the exit blocks of the original scalar loop. | |
| VPIRBasicBlock * | getExitBlock (BasicBlock *IRBB) const |
Return the VPIRBasicBlock corresponding to IRBB. | |
| bool | isExitBlock (VPBlockBase *VPBB) |
Returns true if VPBB is an exit block. | |
| VPValue * | getTripCount () const |
| The trip count of the original loop. | |
| void | setTripCount (VPValue *NewTripCount) |
| Set the trip count assuming it is currently null; if it is not - use resetTripCount(). | |
| void | resetTripCount (VPValue *NewTripCount) |
| Resets the trip count for the VPlan. | |
| VPValue * | getOrCreateBackedgeTakenCount () |
| The backedge taken count of the original loop. | |
| VPValue * | getBackedgeTakenCount () const |
| VPSymbolicValue & | getVectorTripCount () |
| The vector trip count. | |
| VPSymbolicValue & | getVF () |
| Returns the VF of the vector loop region. | |
| const VPSymbolicValue & | getVF () const |
| VPSymbolicValue & | getUF () |
| Returns the UF of the vector loop region. | |
| VPSymbolicValue & | getVFxUF () |
| Returns VF * UF of the vector loop region. | |
| LLVMContext & | getContext () const |
| const DataLayout & | getDataLayout () const |
| void | addVF (ElementCount VF) |
| void | setVF (ElementCount VF) |
| void | removeVF (ElementCount VF) |
Remove VF from the plan. | |
| bool | hasVF (ElementCount VF) const |
| bool | hasScalableVF () const |
| iterator_range< SmallSetVector< ElementCount, 2 >::iterator > | vectorFactors () const |
| Returns an iterator range over all VFs of the plan. | |
| bool | hasScalarVFOnly () const |
| bool | hasUF (unsigned UF) const |
| unsigned | getConcreteUF () const |
| Returns the concrete UF of the plan, after unrolling. | |
| void | setUF (unsigned UF) |
| bool | isUnrolled () const |
| Returns true if the VPlan already has been unrolled, i.e. | |
| std::string | getName () const |
| Return a string with the name of the plan and the applicable VFs and UFs. | |
| void | setName (const Twine &newName) |
| VPIRValue * | getOrAddLiveIn (Value *V) |
Gets the live-in VPIRValue for V or adds a new live-in (if none exists yet) for V. | |
| VPIRValue * | getOrAddLiveIn (VPIRValue *V) |
| VPIRValue * | getTrue () |
| Return a VPIRValue wrapping i1 true. | |
| VPIRValue * | getFalse () |
| Return a VPIRValue wrapping i1 false. | |
| VPIRValue * | getZero (Type *Ty) |
Return a VPIRValue wrapping the null value of type Ty. | |
| VPIRValue * | getAllOnesValue (Type *Ty) |
Return a VPIRValue wrapping the AllOnes value of type Ty. | |
| VPIRValue * | getConstantInt (Type *Ty, uint64_t Val, bool IsSigned=false) |
| Return a VPIRValue wrapping a ConstantInt with the given type and value. | |
| VPIRValue * | getConstantInt (unsigned BitWidth, uint64_t Val, bool IsSigned=false) |
| Return a VPIRValue wrapping a ConstantInt with the given bitwidth and value. | |
| VPIRValue * | getConstantInt (const APInt &Val) |
| Return a VPIRValue wrapping a ConstantInt with the given APInt value. | |
| VPIRValue * | getLiveIn (Value *V) const |
Return the live-in VPIRValue for V, if there is one or nullptr otherwise. | |
| auto | getLiveIns () const |
| Return the list of live-in VPValues available in the VPlan. | |
| void | printLiveIns (raw_ostream &O) const |
Print the live-ins of this VPlan to O. | |
| LLVM_ABI_FOR_TEST void | print (raw_ostream &O) const |
Print this VPlan to O. | |
| LLVM_ABI_FOR_TEST void | printDOT (raw_ostream &O) const |
Print this VPlan in DOT format to O. | |
| LLVM_DUMP_METHOD void | dump () const |
| Dump the plan to stderr (for debugging). | |
| LLVM_ABI_FOR_TEST VPlan * | duplicate () |
| Clone the current VPlan, update all VPValues of the new VPlan and cloned recipes to refer to the clones, and return it. | |
| VPBasicBlock * | createVPBasicBlock (const Twine &Name, VPRecipeBase *Recipe=nullptr) |
Create a new VPBasicBlock with Name and containing Recipe if present. | |
| VPRegionBlock * | createLoopRegion (const std::string &Name="", VPBlockBase *Entry=nullptr, VPBlockBase *Exiting=nullptr) |
Create a new loop region with Name and entry and exiting blocks set to Entry and Exiting respectively, if set. | |
| VPRegionBlock * | createReplicateRegion (VPBlockBase *Entry, VPBlockBase *Exiting, const std::string &Name="") |
Create a new replicate region with Entry, Exiting and Name. | |
| VPIRBasicBlock * | createEmptyVPIRBasicBlock (BasicBlock *IRBB) |
Create a VPIRBasicBlock wrapping IRBB, but do not create VPIRInstructions wrapping the instructions in tIRBB. | |
| LLVM_ABI_FOR_TEST VPIRBasicBlock * | createVPIRBasicBlock (BasicBlock *IRBB) |
Create a VPIRBasicBlock from IRBB containing VPIRInstructions for all instructions in IRBB, except its terminator which is managed by the successors of the block in VPlan. | |
| bool | hasEarlyExit () const |
| Returns true if the VPlan is based on a loop with an early exit. | |
| bool | hasScalarTail () const |
| Returns true if the scalar tail may execute after the vector loop. | |
Friends | |
| class | VPlanPrinter |
| class | VPSlotTracker |
VPlan models a candidate for vectorization, encoding various decisions take to produce efficient output IR, including which branches, basic-blocks and output IR instructions to generate, and their cost.
VPlan holds a Hierarchical-CFG of VPBasicBlocks and VPRegionBlocks rooted at an Entry VPBasicBlock.
| VPlan::VPlan | ( | Loop * | L | ) |
Construct a VPlan for L.
This will create VPIRBasicBlocks wrapping the original preheader and scalar header of L, to be used as entry and scalar header blocks of the new VPlan.
Definition at line 872 of file VPlan.cpp.
References createVPIRBasicBlock(), and setEntry().
|
inline |
Construct a VPlan with a new VPBasicBlock as entry, a VPIRBasicBlock wrapping ScalarHeaderBB and a trip count of TC.
Definition at line 4661 of file VPlan.h.
References createVPBasicBlock(), createVPIRBasicBlock(), and setEntry().
| VPlan::~VPlan | ( | ) |
Definition at line 882 of file VPlan.cpp.
References llvm::dyn_cast(), getLiveIns(), and I.
|
inline |
| InstructionCost VPlan::cost | ( | ElementCount | VF, |
| VPCostContext & | Ctx ) |
Return the cost of this plan.
Definition at line 1040 of file VPlan.cpp.
References llvm::any_of(), llvm::VPBlockUtils::blocksOnly(), llvm::VPBasicBlock::cost(), llvm::VPRegionBlock::cost(), getEntry(), llvm::InstructionCost::getInvalid(), getVectorLoopRegion(), llvm::InstructionCost::isValid(), and llvm::vp_depth_first_shallow().
| VPIRBasicBlock * VPlan::createEmptyVPIRBasicBlock | ( | BasicBlock * | IRBB | ) |
Create a VPIRBasicBlock wrapping IRBB, but do not create VPIRInstructions wrapping the instructions in tIRBB.
The returned block is owned by the VPlan and deleted once the VPlan is destroyed.
Definition at line 1271 of file VPlan.cpp.
Referenced by llvm::VPIRBasicBlock::clone(), and createVPIRBasicBlock().
|
inline |
Create a new loop region with Name and entry and exiting blocks set to Entry and Exiting respectively, if set.
The returned block is owned by the VPlan and deleted once the VPlan is destroyed.
Definition at line 4931 of file VPlan.h.
Referenced by createLoopRegion().
|
inline |
Create a new replicate region with Entry, Exiting and Name.
The returned block is owned by the VPlan and deleted once the VPlan is destroyed.
Definition at line 4942 of file VPlan.h.
Referenced by createReplicateRegion().
|
inline |
Create a new VPBasicBlock with Name and containing Recipe if present.
The returned block is owned by the VPlan and deleted once the VPlan is destroyed.
Definition at line 4921 of file VPlan.h.
Referenced by addInitialSkeleton(), llvm::VPBasicBlock::clone(), createReplicateRegion(), llvm::VPlanTransforms::expandBranchOnTwoConds(), llvm::VPlanTransforms::handleUncountableEarlyExits(), llvm::VPBasicBlock::splitAt(), and VPlan().
| VPIRBasicBlock * VPlan::createVPIRBasicBlock | ( | BasicBlock * | IRBB | ) |
Create a VPIRBasicBlock from IRBB containing VPIRInstructions for all instructions in IRBB, except its terminator which is managed by the successors of the block in VPlan.
The returned block is owned by the VPlan and deleted once the VPlan is destroyed.
Definition at line 1277 of file VPlan.cpp.
References llvm::BasicBlock::begin(), llvm::VPIRInstruction::create(), createEmptyVPIRBasicBlock(), llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::BasicBlock::getTerminator(), I, and llvm::make_range().
Referenced by llvm::VPlanTransforms::attachCheckBlock(), duplicate(), VPlan(), and VPlan().
| LLVM_DUMP_METHOD void VPlan::dump | ( | ) | const |
Dump the plan to stderr (for debugging).
Definition at line 1165 of file VPlan.cpp.
References llvm::dbgs(), and print().
Referenced by execute().
| VPlan * VPlan::duplicate | ( | ) |
Clone the current VPlan, update all VPValues of the new VPlan and cloned recipes to refer to the clones, and return it.
Definition at line 1206 of file VPlan.cpp.
References assert(), llvm::cast(), llvm::VPBlockUtils::cloneFrom(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::contains(), createVPIRBasicBlock(), llvm::dyn_cast(), llvm::dyn_cast_or_null(), llvm::find_if(), llvm::VPIRBasicBlock::getIRBasicBlock(), getLiveIns(), llvm::VPBlockBase::getNumSuccessors(), getScalarHeader(), I, llvm::isa(), remapOperands(), llvm::seq(), and llvm::vp_depth_first_shallow().
Referenced by llvm::VPlanTransforms::narrowInterleaveGroups(), and llvm::LoopVectorizePass::processLoop().
| void VPlan::execute | ( | VPTransformState * | State | ) |
Generate the IR code for this VPlan.
Generate the code inside the preheader and body of the vectorized loop.
Assumes a single pre-header basic-block was created for this. Introduce additional basic-blocks as needed, and fill them all.
Definition at line 922 of file VPlan.cpp.
References llvm::any_of(), llvm::Block, llvm::cast(), llvm::dbgs(), llvm::DominatorTreeBase< BasicBlock, false >::Delete, llvm::DeleteDeadBlocks(), llvm::drop_begin(), dump(), llvm::dyn_cast(), llvm::LoopBase< BlockT, LoopT >::getBlocksVector(), getConcreteUF(), getExitBlocks(), llvm::vputils::getFirstLoopHeader(), getScalarHeader(), getScalarPreheader(), llvm::BasicBlock::getSingleSuccessor(), llvm::BasicBlock::getTerminator(), hasEarlyExit(), llvm::VPBlockBase::hasPredecessors(), llvm::isa(), LLVM_DEBUG, llvm::make_early_inc_range(), printFinalVPlan(), llvm::reverse(), RUN_VPLAN_PASS, setName(), llvm::succ_begin(), and llvm::successors().
Referenced by llvm::LoopVectorizationPlanner::executePlan().
Return a VPIRValue wrapping the AllOnes value of type Ty.
Definition at line 4872 of file VPlan.h.
References llvm::APInt::getAllOnes(), and getConstantInt().
Referenced by simplifyRecipe().
|
inline |
Definition at line 4763 of file VPlan.h.
Referenced by llvm::vputils::isHeaderMask().
|
inline |
Returns the concrete UF of the plan, after unrolling.
Definition at line 4821 of file VPlan.h.
References assert().
Referenced by llvm::VPlanTransforms::addBranchWeightToMiddleTerminator(), llvm::VPlanTransforms::convertToConcreteRecipes(), execute(), llvm::VPlanTransforms::materializeFactors(), llvm::VPlanTransforms::optimizeForVFAndUF(), and simplifyRecipe().
Return a VPIRValue wrapping a ConstantInt with the given APInt value.
Definition at line 4889 of file VPlan.h.
References getContext(), and getOrAddLiveIn().
Return a VPIRValue wrapping a ConstantInt with the given type and value.
Definition at line 4877 of file VPlan.h.
References getOrAddLiveIn().
Referenced by llvm::VPlanTransforms::addActiveLaneMask(), addCanonicalIVRecipes(), llvm::VPlanTransforms::addExplicitVectorLength(), addLaneToStartIndex(), addStartIndexForScalarSteps(), addVPLaneMaskPhiAndUpdateExitBranch(), llvm::VPlanTransforms::adjustFixedOrderRecurrences(), cloneForLane(), llvm::VPlanTransforms::convertToConcreteRecipes(), llvm::VPBuilder::createElementCount(), llvm::VPlanTransforms::createInLoopReductionRecipes(), llvm::VPlanTransforms::createInterleaveGroups(), getAllOnesValue(), getConstantInt(), getFalse(), getTrue(), getZero(), handleFirstArgMinOrMax(), llvm::VPlanTransforms::materializeBackedgeTakenCount(), llvm::VPlanTransforms::materializeFactors(), llvm::VPVectorEndPointerRecipe::materializeOffset(), llvm::VPlanTransforms::materializeVectorTripCount(), llvm::VPlanTransforms::narrowInterleaveGroups(), optimizeEarlyExitInductionUser(), llvm::VPlanTransforms::optimizeFindIVReductions(), optimizeMaskToEVL(), optimizeVectorInductionWidthForTCAndVFUF(), processLaneForReplicateRegion(), llvm::VPlanTransforms::replaceSymbolicStrides(), tryToReplaceALMWithWideALM(), and llvm::VPlanTransforms::unrollByUF().
|
inline |
Return a VPIRValue wrapping a ConstantInt with the given bitwidth and value.
Definition at line 4883 of file VPlan.h.
References llvm::BitWidth, and getConstantInt().
|
inline |
Definition at line 4778 of file VPlan.h.
References llvm::BasicBlock::getContext(), llvm::VPIRBasicBlock::getIRBasicBlock(), and getScalarHeader().
Referenced by llvm::VPlanTransforms::addBranchWeightToMiddleTerminator(), addBypassBranch(), llvm::VPlanTransforms::addExplicitVectorLength(), llvm::VPlanTransforms::addMinimumIterationCheck(), llvm::VPlanTransforms::addMinimumVectorEpilogueIterationCheck(), expandVPWidenIntOrFpInduction(), fixupVFUsersForEVL(), getConstantInt(), optimizeVectorInductionWidthForTCAndVFUF(), llvm::VPlanTransforms::simplifyKnownEVL(), llvm::VPlanTransforms::truncateToMinimalBitwidths(), and tryToReplaceALMWithWideALM().
|
inline |
Definition at line 4782 of file VPlan.h.
References llvm::BasicBlock::getDataLayout(), llvm::VPIRBasicBlock::getIRBasicBlock(), and getScalarHeader().
Referenced by llvm::VPVectorEndPointerRecipe::materializeOffset(), llvm::VPlanTransforms::simplifyKnownEVL(), and simplifyRecipe().
|
inline |
Definition at line 4679 of file VPlan.h.
Referenced by addInitialSkeleton(), llvm::VPlanTransforms::addMinimumIterationCheck(), llvm::VPlanTransforms::addMinimumVectorEpilogueIterationCheck(), addReplicateRegions(), connectEpilogueVectorLoop(), llvm::VPlanTransforms::convertToConcreteRecipes(), llvm::VPlanTransforms::convertToVariableLengthStep(), cost(), llvm::VPlanTransforms::createHeaderPhiRecipes(), llvm::VPlanTransforms::createLoopRegions(), llvm::VPlanTransforms::cse(), llvm::VPlanTransforms::dissolveLoopRegions(), llvm::VPlanTransforms::dropPoisonGeneratingRecipes(), llvm::LoopVectorizationPlanner::executePlan(), llvm::VPlanTransforms::expandBranchOnTwoConds(), llvm::VPlanTransforms::expandSCEVs(), llvm::DomTreeNodeTraits< VPBlockBase >::getEntryNode(), llvm::vputils::getFirstLoopHeader(), llvm::vputils::getOrCreateVPValueForSCEVExpr(), getVectorLoopRegion(), getVectorLoopRegion(), hasScalarTail(), llvm::vputils::isUniformAcrossVFsAndUFs(), llvm::VPlanTransforms::materializeBroadcasts(), llvm::VPlanTransforms::materializePacksAndUnpacks(), llvm::VPlanTransforms::mergeBlocksIntoPredecessors(), mergeReplicateRegionsIntoSuccessors(), preparePlanForEpilogueVectorLoop(), preparePlanForMainVectorLoop(), print(), llvm::VPlanTransforms::removeBranchOnConst(), llvm::VPlanTransforms::removeDeadRecipes(), removeRedundantExpandSCEVRecipes(), llvm::VPlanTransforms::replaceSymbolicStrides(), llvm::VPlanTransforms::replicateByVF(), llvm::VPBlockBase::setPlan(), llvm::VPlanTransforms::simplifyKnownEVL(), llvm::VPlanTransforms::simplifyRecipes(), sinkScalarOperands(), and llvm::VPlanTransforms::unrollByUF().
|
inline |
| VPIRBasicBlock * VPlan::getExitBlock | ( | BasicBlock * | IRBB | ) | const |
Return the VPIRBasicBlock corresponding to IRBB.
IRBB must be an exit block.
Definition at line 904 of file VPlan.cpp.
References assert(), llvm::find_if(), getExitBlocks(), and llvm::VPIRBasicBlock::getIRBasicBlock().
|
inline |
Return an ArrayRef containing VPIRBasicBlocks wrapping the exit blocks of the original scalar loop.
Definition at line 4727 of file VPlan.h.
Referenced by calculateEarlyExitCost(), createExtractsForLiveOuts(), execute(), llvm::LoopVectorizationPlanner::executePlan(), llvm::VPlanTransforms::foldTailByMasking(), getExitBlock(), llvm::VPlanTransforms::handleEarlyExits(), llvm::VPlanTransforms::handleUncountableEarlyExits(), and llvm::VPlanTransforms::optimizeInductionLiveOutUsers().
|
inline |
Return a VPIRValue wrapping i1 false.
Definition at line 4866 of file VPlan.h.
References getConstantInt().
Referenced by llvm::VPlanTransforms::addMinimumIterationCheck(), llvm::VPlanTransforms::handleFindLastReductions(), llvm::VPlanTransforms::optimizeEVLMasks(), llvm::VPlanTransforms::optimizeFindIVReductions(), and simplifyRecipe().
Return the live-in VPIRValue for V, if there is one or nullptr otherwise.
Definition at line 4895 of file VPlan.h.
Referenced by createWidenInductionRecipe(), and llvm::VPlanTransforms::replaceSymbolicStrides().
|
inline |
Return the list of live-in VPValues available in the VPlan.
Definition at line 4898 of file VPlan.h.
Referenced by duplicate(), llvm::VPlanTransforms::materializeBroadcasts(), simplifyLiveInsWithSCEV(), and ~VPlan().
|
inline |
Returns the 'middle' block of the plan, that is the block that selects whether to execute the scalar tail loop or the exit block from the loop latch.
If there is an early exit from the vector loop, the middle block conceptully has the early exit block as third successor, split accross 2 VPBBs. In that case, the second VPBB selects whether to execute the scalar tail loop or the exit block. If the scalar tail loop or exit block are known to always execute, the middle block may branch directly to that block. This function cannot be called once the vector loop region has been removed.
Definition at line 4704 of file VPlan.h.
References assert(), llvm::SmallVectorTemplateCommon< T, typename >::back(), llvm::cast(), llvm::VPBlockBase::getSuccessors(), and getVectorLoopRegion().
Referenced by llvm::VPlanTransforms::addBranchWeightToMiddleTerminator(), llvm::VPlanTransforms::addExitUsersForFirstOrderRecurrences(), calculateEarlyExitCost(), llvm::VPlanTransforms::createInLoopReductionRecipes(), llvm::VPlanTransforms::foldTailByMasking(), getMiddleBlock(), llvm::VPlanTransforms::handleMaxMinNumReductions(), isOutsideLoopWorkProfitable(), llvm::VPlanTransforms::materializeConstantVectorTripCount(), llvm::VPlanTransforms::narrowInterleaveGroups(), llvm::VPlanTransforms::optimizeInductionLiveOutUsers(), planContainsAdditionalSimplifications(), preparePlanForMainVectorLoop(), and llvm::LoopVectorizePass::processLoop().
|
inline |
Definition at line 4713 of file VPlan.h.
References getMiddleBlock().
| std::string VPlan::getName | ( | ) | const |
Return a string with the name of the plan and the applicable VFs and UFs.
Definition at line 1135 of file VPlan.cpp.
References llvm::drop_begin().
Referenced by print().
Gets the live-in VPIRValue for V or adds a new live-in (if none exists yet) for V.
Definition at line 4843 of file VPlan.h.
References assert(), llvm::dyn_cast(), and llvm::isa().
Referenced by addLaneToStartIndex(), llvm::VPlanTransforms::addMinimumVectorEpilogueIterationCheck(), llvm::VPlanTransforms::attachCheckBlock(), convertRecipesInRegionBlocksToSingleScalar(), llvm::VPlanTransforms::expandSCEVs(), fixupVFUsersForEVL(), llvm::VPlanTransforms::foldTailByMasking(), getConstantInt(), getConstantInt(), getOrAddLiveIn(), llvm::vputils::getOrCreateVPValueForSCEVExpr(), handleFirstArgMinOrMax(), llvm::VPlanTransforms::optimizeFindIVReductions(), preparePlanForEpilogueVectorLoop(), and simplifyLiveInsWithSCEV().
Definition at line 4857 of file VPlan.h.
References assert(), and getOrAddLiveIn().
|
inline |
The backedge taken count of the original loop.
Definition at line 4758 of file VPlan.h.
Referenced by llvm::VPlanTransforms::foldTailByMasking(), llvm::VPlanTransforms::materializeBackedgeTakenCount(), llvm::VPlanTransforms::materializeBroadcasts(), and optimizeVectorInductionWidthForTCAndVFUF().
|
inline |
Return the VPIRBasicBlock wrapping the header of the scalar loop.
Definition at line 4723 of file VPlan.h.
Referenced by addInitialSkeleton(), llvm::VPlanTransforms::addMiddleCheck(), duplicate(), execute(), fixScalarResumeValuesFromBypass(), getContext(), getDataLayout(), getScalarPreheader(), llvm::VPlanTransforms::handleEarlyExits(), preparePlanForMainVectorLoop(), llvm::VPlanTransforms::replicateByVF(), llvm::VPlanTransforms::runPass(), and llvm::VPSlotTracker::VPSlotTracker().
|
inline |
Return the VPBasicBlock for the preheader of the scalar loop.
Definition at line 4718 of file VPlan.h.
References llvm::cast(), and getScalarHeader().
Referenced by llvm::VPlanTransforms::addMiddleCheck(), connectEpilogueVectorLoop(), llvm::VPlanTransforms::createHeaderPhiRecipes(), llvm::VPlanTransforms::createInLoopReductionRecipes(), createWidenInductionRecipe(), execute(), llvm::LoopVectorizationPlanner::executePlan(), fixScalarResumeValuesFromBypass(), llvm::VPlanTransforms::handleMaxMinNumReductions(), hasScalarTail(), insertCheckBlockBeforeVectorLoop(), llvm::VPlanTransforms::materializeConstantVectorTripCount(), llvm::VPlanTransforms::narrowInterleaveGroups(), preparePlanForMainVectorLoop(), and llvm::LoopVectorizationPlanner::updateLoopMetadataAndProfileInfo().
|
inline |
The trip count of the original loop.
Definition at line 4737 of file VPlan.h.
References assert().
Referenced by llvm::VPlanTransforms::addActiveLaneMask(), llvm::VPlanTransforms::addExplicitVectorLength(), llvm::VPlanTransforms::addMiddleCheck(), llvm::VPlanTransforms::addMinimumIterationCheck(), addVPLaneMaskPhiAndUpdateExitBranch(), llvm::VPlanTransforms::convertEVLExitCond(), llvm::LoopVectorizationPlanner::executePlan(), llvm::VPlanTransforms::expandSCEVs(), llvm::VPlanTransforms::handleMaxMinNumReductions(), isConditionTrueViaVFAndUF(), llvm::vputils::isHeaderMask(), llvm::VPlanTransforms::materializeBackedgeTakenCount(), llvm::VPlanTransforms::materializeConstantVectorTripCount(), llvm::VPlanTransforms::materializeFactors(), llvm::VPlanTransforms::materializeVectorTripCount(), llvm::VPlanTransforms::optimizeInductionLiveOutUsers(), optimizeVectorInductionWidthForTCAndVFUF(), preparePlanForEpilogueVectorLoop(), llvm::VPlanTransforms::replaceSymbolicStrides(), llvm::LoopVectorizationPlanner::selectEpilogueVectorizationFactor(), simplifyBranchConditionForVFAndUF(), and llvm::VPlanTransforms::unrollByUF().
|
inline |
Return a VPIRValue wrapping i1 true.
Definition at line 4863 of file VPlan.h.
References getConstantInt().
Referenced by llvm::VPlanTransforms::addMiddleCheck(), llvm::VPlanTransforms::addMinimumIterationCheck(), fixupVFUsersForEVL(), llvm::VPlanTransforms::optimizeEVLMasks(), optimizeMaskToEVL(), and simplifyBranchConditionForVFAndUF().
|
inline |
Returns the UF of the vector loop region.
Definition at line 4773 of file VPlan.h.
Referenced by llvm::VPlanTransforms::narrowInterleaveGroups(), llvm::LoopVectorizationPlanner::selectEpilogueVectorizationFactor(), and llvm::VPlanTransforms::unrollByUF().
| VPRegionBlock * VPlan::getVectorLoopRegion | ( | ) |
Returns the VPRegionBlock of the vector loop.
Definition at line 1058 of file VPlan.cpp.
References B(), llvm::dyn_cast(), getEntry(), and llvm::vp_depth_first_shallow().
Referenced by llvm::VPlanTransforms::addActiveLaneMask(), addBypassBranch(), llvm::VPlanTransforms::addExitUsersForFirstOrderRecurrences(), llvm::VPlanTransforms::addExplicitVectorLength(), addVPLaneMaskPhiAndUpdateExitBranch(), llvm::VPlanTransforms::adjustFixedOrderRecurrences(), llvm::LoopVectorizationPlanner::buildVPlans(), llvm::calculateRegisterUsageForPlan(), llvm::VPlanTransforms::clearReductionWrapFlags(), llvm::collectEphemeralRecipesForVPlan(), collectGroupedReplicateMemOps(), llvm::LoopVectorizationPlanner::computeBestVF(), llvm::VPlanTransforms::convertEVLExitCond(), llvm::VPlanTransforms::convertToAbstractRecipes(), cost(), llvm::VPlanTransforms::createInLoopReductionRecipes(), llvm::VPlanTransforms::createLoopRegions(), llvm::VPlanTransforms::createPartialReductions(), createScalarIVSteps(), expandVPWidenIntOrFpInduction(), expandVPWidenPointerInduction(), llvm::vputils::findHeaderMask(), fixupVFUsersForEVL(), llvm::VPlanTransforms::foldTailByMasking(), getMiddleBlock(), llvm::vputils::getRecipesForUncountableExit(), getVectorPreheader(), llvm::VPlanTransforms::handleFindLastReductions(), handleFirstArgMinOrMax(), llvm::VPlanTransforms::handleMaxMinNumReductions(), llvm::VPlanTransforms::handleMultiUseReductions(), hasFindLastReductionPhi(), hasReplicatorRegion(), hasUnsupportedHeaderPhiRecipe(), llvm::VPlanTransforms::hoistInvariantLoads(), llvm::VPlanTransforms::introduceMasksAndLinearize(), isConditionTrueViaVFAndUF(), legalizeAndOptimizeInductions(), licm(), llvm::VPlanTransforms::materializePacksAndUnpacks(), llvm::VPlanTransforms::narrowInterleaveGroups(), narrowToSingleScalarRecipes(), optimizeEarlyExitInductionUser(), llvm::VPlanTransforms::optimizeEVLMasks(), llvm::VPlanTransforms::optimizeFindIVReductions(), llvm::VPlanTransforms::optimizeInductionLiveOutUsers(), optimizeVectorInductionWidthForTCAndVFUF(), planContainsAdditionalSimplifications(), preparePlanForEpilogueVectorLoop(), preparePlanForMainVectorLoop(), removeRedundantCanonicalIVs(), removeRedundantInductionCasts(), llvm::VPlanTransforms::replaceSymbolicStrides(), llvm::VPlanTransforms::replicateByVF(), replicateReplicateRegionsByVF(), llvm::VPlanTransforms::runPass(), scalarizeInstruction(), llvm::LoopVectorizationPlanner::selectEpilogueVectorizationFactor(), llvm::LoopVectorizationPlanner::selectInterleaveCount(), simplifyBlends(), simplifyBranchConditionForVFAndUF(), llvm::VPlanTransforms::truncateToMinimalBitwidths(), llvm::VPlanTransforms::tryToConvertVPInstructionsToVPRecipes(), tryToReplaceALMWithWideALM(), llvm::VPlanTransforms::unrollByUF(), llvm::VPCostContext::useEmulatedMaskMemRefHack(), llvm::VPInterleavedAccessInfo::VPInterleavedAccessInfo(), llvm::VPTypeAnalysis::VPTypeAnalysis(), and willGenerateVectors().
| const VPRegionBlock * VPlan::getVectorLoopRegion | ( | ) | const |
Definition at line 1066 of file VPlan.cpp.
References B(), llvm::dyn_cast(), getEntry(), and llvm::vp_depth_first_shallow().
|
inline |
Returns the preheader of the vector loop region, if one exists, or null otherwise.
Definition at line 4684 of file VPlan.h.
References llvm::cast(), llvm::VPBlockBase::getSinglePredecessor(), and getVectorLoopRegion().
Referenced by addVPLaneMaskPhiAndUpdateExitBranch(), llvm::LoopVectorizationPlanner::executePlan(), expandVPWidenIntOrFpInduction(), llvm::VPlanTransforms::hoistInvariantLoads(), insertCheckBlockBeforeVectorLoop(), llvm::vputils::isUniformAcrossVFsAndUFs(), licm(), llvm::VPlanTransforms::materializeBroadcasts(), llvm::VPlanTransforms::narrowInterleaveGroups(), optimizeVectorInductionWidthForTCAndVFUF(), planContainsAdditionalSimplifications(), llvm::LoopVectorizePass::processLoop(), and llvm::VPlanTransforms::truncateToMinimalBitwidths().
|
inline |
The vector trip count.
Definition at line 4766 of file VPlan.h.
Referenced by addCanonicalIVRecipes(), llvm::VPlanTransforms::addMiddleCheck(), llvm::calculateRegisterUsageForPlan(), llvm::VPlanTransforms::convertEVLExitCond(), llvm::VPlanTransforms::foldTailByMasking(), llvm::VPlanTransforms::handleMaxMinNumReductions(), isConditionTrueViaVFAndUF(), llvm::VPlanTransforms::materializeConstantVectorTripCount(), llvm::VPlanTransforms::materializeVectorTripCount(), llvm::VPlanTransforms::narrowInterleaveGroups(), llvm::VPlanTransforms::optimizeInductionLiveOutUsers(), and simplifyBranchConditionForVFAndUF().
|
inline |
Returns the VF of the vector loop region.
Definition at line 4769 of file VPlan.h.
Referenced by addVPLaneMaskPhiAndUpdateExitBranch(), llvm::VPlanTransforms::createInterleaveGroups(), createScalarIVSteps(), createWidenInductionRecipe(), fixupVFUsersForEVL(), llvm::vputils::isHeaderMask(), llvm::VPlanTransforms::materializeFactors(), llvm::VPlanTransforms::narrowInterleaveGroups(), optimizeMaskToEVL(), and llvm::VPlanTransforms::unrollByUF().
|
inline |
|
inline |
Returns VF * UF of the vector loop region.
Definition at line 4776 of file VPlan.h.
Referenced by addCanonicalIVRecipes(), llvm::VPlanTransforms::convertToVariableLengthStep(), createWidenInductionRecipe(), llvm::LoopVectorizationPlanner::executePlan(), fixupVFUsersForEVL(), llvm::VPlanTransforms::foldTailByMasking(), llvm::VPlanTransforms::materializeFactors(), llvm::VPlanTransforms::narrowInterleaveGroups(), and simplifyBranchConditionForVFAndUF().
Return a VPIRValue wrapping the null value of type Ty.
Definition at line 4869 of file VPlan.h.
References getConstantInt().
Referenced by llvm::VPlanTransforms::convertEVLExitCond(), convertRecipesInRegionBlocksToSingleScalar(), llvm::VPlanTransforms::materializeVectorTripCount(), optimizeLatchExitInductionUser(), optimizeVectorInductionWidthForTCAndVFUF(), preparePlanForMainVectorLoop(), scalarizeVPWidenPointerInduction(), and simplifyRecipe().
|
inline |
Returns true if the VPlan is based on a loop with an early exit.
That is the case if the VPlan has either more than one exit block or a single exit block with multiple predecessors (one for the exit via the latch and one via the other early exit).
Definition at line 4964 of file VPlan.h.
References llvm::count_if(), and llvm::VPBlockBase::hasPredecessors().
Referenced by execute(), llvm::LoopVectorizationPlanner::executePlan(), and llvm::LoopVectorizationPlanner::selectInterleaveCount().
|
inline |
Definition at line 4801 of file VPlan.h.
References llvm::any_of().
Referenced by llvm::VPlanTransforms::convertToConcreteRecipes(), expandVPWidenPointerInduction(), and legalizeAndOptimizeInductions().
|
inline |
Returns true if the scalar tail may execute after the vector loop.
Note that this relies on unneeded branches to the scalar tail loop being removed.
Definition at line 4974 of file VPlan.h.
References getEntry(), getScalarPreheader(), llvm::VPBlockBase::getSinglePredecessor(), and llvm::VPBlockBase::hasPredecessors().
Referenced by llvm::VPlanTransforms::handleMaxMinNumReductions(), and llvm::VPlanTransforms::materializeConstantVectorTripCount().
|
inline |
Definition at line 4811 of file VPlan.h.
References assert(), llvm::ElementCount::getFixed(), and hasVF().
Referenced by llvm::VPlanTransforms::addExplicitVectorLength(), llvm::VPlanTransforms::handleFindLastReductions(), llvm::vputils::isHeaderMask(), legalizeAndOptimizeInductions(), llvm::VPlanTransforms::materializeBroadcasts(), llvm::VPlanTransforms::materializePacksAndUnpacks(), narrowToSingleScalarRecipes(), removeRedundantCanonicalIVs(), llvm::VPlanTransforms::replicateByVF(), simplifyRecipe(), sinkScalarOperands(), and llvm::VPlanTransforms::truncateToMinimalBitwidths().
Definition at line 4818 of file VPlan.h.
Referenced by llvm::LoopVectorizationPlanner::executePlan(), llvm::VPlanTransforms::materializeConstantVectorTripCount(), llvm::VPlanTransforms::optimizeForVFAndUF(), and setUF().
|
inline |
Definition at line 4800 of file VPlan.h.
Referenced by llvm::LoopVectorizationPlanner::executePlan(), hasScalarVFOnly(), llvm::VPlanTransforms::materializeConstantVectorTripCount(), llvm::VPlanTransforms::optimizeForVFAndUF(), removeVF(), and setVF().
| bool VPlan::isExitBlock | ( | VPBlockBase * | VPBB | ) |
Returns true if VPBB is an exit block.
Definition at line 912 of file VPlan.cpp.
References llvm::is_contained().
|
inline |
Returns true if the VPlan already has been unrolled, i.e.
it has a single concrete UF.
Definition at line 4834 of file VPlan.h.
Referenced by simplifyRecipe().
| LLVM_DUMP_METHOD void VPlan::print | ( | raw_ostream & | O | ) | const |
Print this VPlan to O.
Definition at line 1118 of file VPlan.cpp.
References llvm::Block, getEntry(), getName(), printLiveIns(), and VPSlotTracker.
Referenced by dump(), llvm::operator<<(), and llvm::LoopVectorizationPlanner::printPlans().
| LLVM_DUMP_METHOD void VPlan::printDOT | ( | raw_ostream & | O | ) | const |
Print this VPlan in DOT format to O.
Definition at line 1159 of file VPlan.cpp.
References Printer, and VPlanPrinter.
Referenced by llvm::LoopVectorizationPlanner::printPlans().
| void VPlan::printLiveIns | ( | raw_ostream & | O | ) | const |
Print the live-ins of this VPlan to O.
Definition at line 1074 of file VPlan.cpp.
References llvm::isa(), and VPSlotTracker.
Referenced by print().
|
inline |
|
inline |
Resets the trip count for the VPlan.
The caller must make sure all uses of the original trip count have been replaced.
Definition at line 4751 of file VPlan.h.
References assert(), and llvm::VPValue::getNumUsers().
Referenced by llvm::VPlanTransforms::expandSCEVs(), preparePlanForEpilogueVectorLoop(), and llvm::VPlanTransforms::replaceSymbolicStrides().
|
inline |
Definition at line 4668 of file VPlan.h.
References llvm::VPBlockBase::setPlan().
|
inline |
Set the trip count assuming it is currently null; if it is not - use resetTripCount().
Definition at line 4744 of file VPlan.h.
References assert().
Referenced by addInitialSkeleton().
|
inline |
Definition at line 4826 of file VPlan.h.
References assert(), and hasUF().
Referenced by llvm::VPlanTransforms::addExplicitVectorLength(), and llvm::VPlanTransforms::unrollByUF().
|
inline |
Definition at line 4788 of file VPlan.h.
References assert(), and hasVF().
Referenced by llvm::VPlanTransforms::narrowInterleaveGroups(), and llvm::VPlanTransforms::optimizeForVFAndUF().
|
inline |
Returns an iterator range over all VFs of the plan.
Definition at line 4807 of file VPlan.h.
Referenced by llvm::LoopVectorizationPlanner::computeBestVF(), and llvm::VPlanTransforms::narrowInterleaveGroups().
|
friend |
Definition at line 4588 of file VPlan.h.
References VPlanPrinter.
Referenced by printDOT(), and VPlanPrinter.
|
friend |
Definition at line 4589 of file VPlan.h.
References VPSlotTracker.
Referenced by print(), printLiveIns(), and VPSlotTracker.