Go to the documentation of this file.
20 #define DEBUG_TYPE "loop-vectorize"
33 for (
const auto *Block : VPBlockVec) {
34 if (VPBlockSet.
count(Block))
50 assert(VPB->getParent() ==
Region &&
"VPBlockBase has wrong parent");
53 if (VPB->getNumSuccessors() > 1)
54 assert(VPB->getCondBit() &&
"Missing condition bit!");
56 assert(!VPB->getCondBit() &&
"Unexpected condition bit!");
59 const auto &Successors = VPB->getSuccessors();
63 "Multiple instances of the same successor.");
67 const auto &SuccPreds = Succ->getPredecessors();
73 const auto &Predecessors = VPB->getPredecessors();
78 "Multiple instances of the same predecessor.");
82 assert(Pred->getParent() == VPB->getParent() &&
83 "Predecessor is not in the same region.");
86 const auto &PredSuccs = Pred->getSuccessors();
100 assert(!Entry->getNumPredecessors() &&
"Region entry has predecessors.");
117 if (
const auto *SubRegion = dyn_cast<VPRegionBlock>(VPB))
128 assert(!TopRegion->
getParent() &&
"VPlan Top Region should have no parent.");
136 VPBlockUtils::blocksOnly<const VPBasicBlock>(Iter)) {
139 auto RecipeI = VPBB->begin();
140 auto End = VPBB->end();
141 while (RecipeI != End && RecipeI->isPhi())
144 while (RecipeI != End) {
145 if (RecipeI->isPhi() && !isa<VPBlendRecipe>(&*RecipeI)) {
146 errs() <<
"Found phi-like recipe after non-phi recipe";
148 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
152 std::prev(RecipeI)->dump();
163 errs() <<
"VPlan entry block is not a VPBasicBlock\n";
167 if (!isa<VPCanonicalIVPHIRecipe>(&*Entry->begin())) {
168 errs() <<
"VPlan vector loop header does not start with a "
169 "VPCanonicalIVPHIRecipe\n";
175 errs() <<
"VPlan exit block is not a VPBasicBlock\n";
180 errs() <<
"VPlan vector loop exit must end with BranchOnCount "
181 "VPInstruction but is empty\n";
185 auto *LastInst = dyn_cast<VPInstruction>(std::prev(Exit->
end()));
187 errs() <<
"VPlan vector loop exit must end with BranchOnCount "
193 VPBlockUtils::blocksOnly<const VPRegionBlock>(
197 errs() <<
"region entry block has predecessors\n";
201 errs() <<
"region exit block has successors\n";
207 if (KV.second->getNumOperands() != 1) {
208 errs() <<
"live outs must have a single operand\n";
This is an optimization pass for GlobalISel generic memory operations.
static bool verifyPlanIsValid(const VPlan &Plan)
Verify invariants for general VPlans.
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
static void verifyRegion(const VPRegionBlock *Region)
Verify the CFG invariants of VPRegionBlock Region and its nested VPBlockBases.
VPBasicBlock serves as the leaf of the Hierarchical Control-Flow Graph.
static void verifyBlocksInRegion(const VPRegionBlock *Region)
Helper function that verifies the CFG invariants of the VPBlockBases within Region.
Implements a dense probed hash-table based set with some number of buckets stored inline.
raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
const VPBlockBase * getEntry() const
std::pair< iterator, bool > insert(const ValueT &V)
size_type count(const_arg_type_t< ValueT > V) const
Return 1 if the specified key is in the set, 0 otherwise.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
VPBlockBase is the building block of the Hierarchical Control-Flow Graph.
VPRegionBlock represents a collection of VPBasicBlocks and VPRegionBlocks which form a Single-Entry-S...
size_t getNumSuccessors() const
BlockT * getEntry() const
Get the entry BasicBlock of the Region.
initializer< Ty > init(const Ty &Val)
static cl::opt< bool > EnableHCFGVerifier("vplan-verify-hcfg", cl::init(false), cl::Hidden, cl::desc("Verify VPlan H-CFG."))
bool is_contained(R &&Range, const E &Element)
Wrapper function around std::find to detect if an element exists in a container.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
VPRegionBlock * getVectorLoopRegion()
Returns the VPRegionBlock of the vector loop.
iterator_range< df_iterator< T > > depth_first(const T &G)
static bool hasDuplicates(const SmallVectorImpl< VPBlockBase * > &VPBlockVec)
Utility function that checks whether VPBlockVec has duplicate VPBlockBases.
const VPBlockBase * getExit() const
VPRegionBlock * getParent()
const MapVector< PHINode *, VPLiveOut * > & getLiveOuts() const
static void verifyRegionRec(const VPRegionBlock *Region)
Verify the CFG invariants of VPRegionBlock Region and its nested VPBlockBases.
void verifyHierarchicalCFG(const VPRegionBlock *TopRegion) const
Verify the invariants of the H-CFG starting from TopRegion.
Helper for GraphTraits specialization that traverses through VPRegionBlocks.
BlockT * getExit() const
Get the exit BasicBlock of the Region.
VPlan models a candidate for vectorization, encoding various decisions take to produce efficient outp...