diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp --- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -3694,7 +3694,7 @@ // Forget the original basic block. PSE.getSE()->forgetLoop(OrigLoop); - VPBasicBlock *LatchVPBB = Plan.getVectorLoopRegion()->getExitBasicBlock(); + VPBasicBlock *LatchVPBB = Plan.getVectorLoopRegion()->getExitingBasicBlock(); Loop *VectorLoop = LI->getLoopFor(State.CFG.VPBB2IRBB[LatchVPBB]); if (Cost->requiresScalarEpilogue(VF)) { // No edge from the middle block to the unique exit block has been inserted @@ -3905,7 +3905,7 @@ Type *PhiTy = OrigPhi->getType(); VPBasicBlock *LatchVPBB = - PhiR->getParent()->getEnclosingLoopRegion()->getExitBasicBlock(); + PhiR->getParent()->getEnclosingLoopRegion()->getExitingBasicBlock(); BasicBlock *VectorLoopLatch = State.CFG.VPBB2IRBB[LatchVPBB]; // If tail is folded by masking, the vector value to leave the loop should be // a Select choosing between the vectorized LoopExitInst and vectorized Phi, @@ -8684,7 +8684,7 @@ {CanonicalIVPHI}, DL); CanonicalIVPHI->addOperand(CanonicalIVIncrement); - VPBasicBlock *EB = TopRegion->getExitBasicBlock(); + VPBasicBlock *EB = TopRegion->getExitingBasicBlock(); if (IsVPlanNative) EB->setCondBit(nullptr); EB->appendRecipe(CanonicalIVIncrement); @@ -8978,7 +8978,7 @@ Ind->moveBefore(*HeaderVPBB, HeaderVPBB->getFirstNonPhi()); // Adjust the recipes for any inloop reductions. - adjustRecipesForReductions(cast(TopRegion->getExit()), Plan, + adjustRecipesForReductions(cast(TopRegion->getExiting()), Plan, RecipeBuilder, Range.Start); // Introduce a recipe to combine the incoming and previous values of a @@ -9066,7 +9066,7 @@ // Fold Exit block into its predecessor if possible. // TODO: Fold block earlier once all VPlan transforms properly maintain a // VPBasicBlock as exit. - VPBlockUtils::tryToMergeBlockIntoPredecessor(TopRegion->getExit()); + VPBlockUtils::tryToMergeBlockIntoPredecessor(TopRegion->getExiting()); assert(VPlanVerifier::verifyPlanIsValid(*Plan) && "VPlan is invalid"); return Plan; @@ -9110,8 +9110,8 @@ // code-generation. VPRegionBlock *LoopRegion = Plan->getVectorLoopRegion(); VPBasicBlock *Preheader = LoopRegion->getEntryBasicBlock(); - VPBasicBlock *Exit = LoopRegion->getExitBasicBlock(); - VPBlockBase *Latch = Exit->getSinglePredecessor(); + VPBasicBlock *Exiting = LoopRegion->getExitingBasicBlock(); + VPBlockBase *Latch = Exiting->getSinglePredecessor(); VPBlockBase *Header = Preheader->getSingleSuccessor(); // 1. Move preheader block out of main vector loop. @@ -9120,16 +9120,16 @@ VPBlockUtils::connectBlocks(Preheader, LoopRegion); Plan->setEntry(Preheader); - // 2. Disconnect backedge and exit block. + // 2. Disconnect backedge and exiting block. VPBlockUtils::disconnectBlocks(Latch, Header); - VPBlockUtils::disconnectBlocks(Latch, Exit); + VPBlockUtils::disconnectBlocks(Latch, Exiting); - // 3. Update entry and exit of main vector loop region. + // 3. Update entry and exiting of main vector loop region. LoopRegion->setEntry(Header); - LoopRegion->setExit(Latch); + LoopRegion->setExiting(Latch); - // 4. Remove exit block. - delete Exit; + // 4. Remove exiting block. + delete Exiting; addCanonicalIVRecipes(*Plan, Legal->getWidestInductionType(), DebugLoc(), true, true); diff --git a/llvm/lib/Transforms/Vectorize/VPlan.h b/llvm/lib/Transforms/Vectorize/VPlan.h --- a/llvm/lib/Transforms/Vectorize/VPlan.h +++ b/llvm/lib/Transforms/Vectorize/VPlan.h @@ -493,11 +493,11 @@ const VPBasicBlock *getEntryBasicBlock() const; VPBasicBlock *getEntryBasicBlock(); - /// \return the VPBasicBlock that is the exit of this VPBlockBase, + /// \return the VPBasicBlock that is the exiting this VPBlockBase, /// recursively, if the latter is a VPRegionBlock. Otherwise, if this /// VPBlockBase is a VPBasicBlock, it is returned. - const VPBasicBlock *getExitBasicBlock() const; - VPBasicBlock *getExitBasicBlock(); + const VPBasicBlock *getExitingBasicBlock() const; + VPBasicBlock *getExitingBasicBlock(); const VPBlocksTy &getSuccessors() const { return Successors; } VPBlocksTy &getSuccessors() { return Successors; } @@ -2109,7 +2109,7 @@ }; /// VPRegionBlock represents a collection of VPBasicBlocks and VPRegionBlocks -/// which form a Single-Entry-Single-Exit subgraph of the output IR CFG. +/// which form a Single-Entry-Single-Exiting subgraph of the output IR CFG. /// A VPRegionBlock may indicate that its contents are to be replicated several /// times. This is designed to support predicated scalarization, in which a /// scalar if-then code structure needs to be generated VF * UF times. Having @@ -2120,25 +2120,26 @@ /// Hold the Single Entry of the SESE region modelled by the VPRegionBlock. VPBlockBase *Entry; - /// Hold the Single Exit of the SESE region modelled by the VPRegionBlock. - VPBlockBase *Exit; + /// Hold the Single Exiting block of the SESE region modelled by the + /// VPRegionBlock. + VPBlockBase *Exiting; /// An indicator whether this region is to generate multiple replicated /// instances of output IR corresponding to its VPBlockBases. bool IsReplicator; public: - VPRegionBlock(VPBlockBase *Entry, VPBlockBase *Exit, + VPRegionBlock(VPBlockBase *Entry, VPBlockBase *Exiting, const std::string &Name = "", bool IsReplicator = false) - : VPBlockBase(VPRegionBlockSC, Name), Entry(Entry), Exit(Exit), + : VPBlockBase(VPRegionBlockSC, Name), Entry(Entry), Exiting(Exiting), IsReplicator(IsReplicator) { assert(Entry->getPredecessors().empty() && "Entry block has predecessors."); - assert(Exit->getSuccessors().empty() && "Exit block has successors."); + assert(Exiting->getSuccessors().empty() && "Exit block has successors."); Entry->setParent(this); - Exit->setParent(this); + Exiting->setParent(this); } VPRegionBlock(const std::string &Name = "", bool IsReplicator = false) - : VPBlockBase(VPRegionBlockSC, Name), Entry(nullptr), Exit(nullptr), + : VPBlockBase(VPRegionBlockSC, Name), Entry(nullptr), Exiting(nullptr), IsReplicator(IsReplicator) {} ~VPRegionBlock() override { @@ -2172,22 +2173,22 @@ // DominatorTreeBase representing the Graph type. VPBlockBase &front() const { return *Entry; } - const VPBlockBase *getExit() const { return Exit; } - VPBlockBase *getExit() { return Exit; } + const VPBlockBase *getExiting() const { return Exiting; } + VPBlockBase *getExiting() { return Exiting; } - /// Set \p ExitBlock as the exit VPBlockBase of this VPRegionBlock. \p - /// ExitBlock must have no successors. - void setExit(VPBlockBase *ExitBlock) { - assert(ExitBlock->getSuccessors().empty() && + /// Set \p ExitingBlock as the exiting VPBlockBase of this VPRegionBlock. \p + /// ExitingBlock must have no successors. + void setExiting(VPBlockBase *ExitingBlock) { + assert(ExitingBlock->getSuccessors().empty() && "Exit block cannot have successors."); - Exit = ExitBlock; - ExitBlock->setParent(this); + Exiting = ExitingBlock; + ExitingBlock->setParent(this); } /// Returns the pre-header VPBasicBlock of the loop region. VPBasicBlock *getPreheaderVPBB() { assert(!isReplicator() && "should only get pre-header of loop regions"); - return getSinglePredecessor()->getExitBasicBlock(); + return getSinglePredecessor()->getExitingBasicBlock(); } /// An indicator whether this region is to generate multiple replicated @@ -2321,11 +2322,11 @@ using nodes_iterator = df_iterator; static NodeRef getEntryNode(Inverse N) { - return N.Graph->getExit(); + return N.Graph->getExiting(); } static nodes_iterator nodes_begin(GraphRef N) { - return nodes_iterator::begin(N->getExit()); + return nodes_iterator::begin(N->getExiting()); } static nodes_iterator nodes_end(GraphRef N) { @@ -2871,8 +2872,8 @@ R.moveBefore(*PredVPBB, PredVPBB->end()); VPBlockUtils::disconnectBlocks(PredVPBB, VPBB); auto *ParentRegion = cast(Block->getParent()); - if (ParentRegion->getExit() == Block) - ParentRegion->setExit(PredVPBB); + if (ParentRegion->getExiting() == Block) + ParentRegion->setExiting(PredVPBB); SmallVector Successors(Block->successors()); for (auto *Succ : Successors) { VPBlockUtils::disconnectBlocks(Block, Succ); diff --git a/llvm/lib/Transforms/Vectorize/VPlan.cpp b/llvm/lib/Transforms/Vectorize/VPlan.cpp --- a/llvm/lib/Transforms/Vectorize/VPlan.cpp +++ b/llvm/lib/Transforms/Vectorize/VPlan.cpp @@ -158,25 +158,25 @@ } /// \return the VPBasicBlock that is the exit of Block, possibly indirectly. -const VPBasicBlock *VPBlockBase::getExitBasicBlock() const { +const VPBasicBlock *VPBlockBase::getExitingBasicBlock() const { const VPBlockBase *Block = this; while (const VPRegionBlock *Region = dyn_cast(Block)) - Block = Region->getExit(); + Block = Region->getExiting(); return cast(Block); } -VPBasicBlock *VPBlockBase::getExitBasicBlock() { +VPBasicBlock *VPBlockBase::getExitingBasicBlock() { VPBlockBase *Block = this; while (VPRegionBlock *Region = dyn_cast(Block)) - Block = Region->getExit(); + Block = Region->getExiting(); return cast(Block); } VPBlockBase *VPBlockBase::getEnclosingBlockWithSuccessors() { if (!Successors.empty() || !Parent) return this; - assert(Parent->getExit() == this && - "Block w/o successors not the exit of its parent."); + assert(Parent->getExiting() == this && + "Block w/o successors not the exiting block of its parent."); return Parent->getEnclosingBlockWithSuccessors(); } @@ -261,7 +261,7 @@ // Hook up the new basic block to its predecessors. for (VPBlockBase *PredVPBlock : getHierarchicalPredecessors()) { - VPBasicBlock *PredVPBB = PredVPBlock->getExitBasicBlock(); + VPBasicBlock *PredVPBB = PredVPBlock->getExitingBasicBlock(); auto &PredVPSuccessors = PredVPBB->getSuccessors(); BasicBlock *PredBB = CFG.VPBB2IRBB[PredVPBB]; @@ -298,14 +298,14 @@ "Trying to reset an existing successor block."); PredBBTerminator->setSuccessor(idx, NewBB); } else { - // PredVPBB is the exit block of a loop region. Connect its successor + // PredVPBB is the exiting block of a loop region. Connect its successor // outside the region. auto *LoopRegion = cast(PredVPBB->getParent()); assert(!LoopRegion->isReplicator() && "predecessor must be in a loop region"); assert(PredVPSuccessors.empty() && - LoopRegion->getExitBasicBlock() == PredVPBB && - "PredVPBB must be the exit block of its parent region"); + LoopRegion->getExitingBasicBlock() == PredVPBB && + "PredVPBB must be the exiting block of its parent region"); assert(this == LoopRegion->getSingleSuccessor() && "the current block must be the single successor of the region"); PredBBTerminator->setSuccessor(0, NewBB); @@ -334,7 +334,7 @@ State->CFG.PrevBB = NewBB; } else if (PrevVPBB && /* A */ !((SingleHPred = getSingleHierarchicalPredecessor()) && - SingleHPred->getExitBasicBlock() == PrevVPBB && + SingleHPred->getExitingBasicBlock() == PrevVPBB && PrevVPBB->getSingleHierarchicalSuccessor() && (SingleHPred->getParent() == getEnclosingLoopRegion() && !IsLoopRegion(SingleHPred))) && /* B */ @@ -345,7 +345,7 @@ // is PrevVPBB and the latter has a single (hierarchical) successor which // both are in the same non-replicator region; and // C. when the current VPBB is an entry of a region replica - where PrevVPBB - // is the exit of this region from a previous instance, or the + // is the exiting VPBB of this region from a previous instance, or the // predecessor of this region. NewBB = createEmptyBasicBlock(State->CFG); @@ -986,7 +986,7 @@ } } - VPBasicBlock *LatchVPBB = getVectorLoopRegion()->getExitBasicBlock(); + VPBasicBlock *LatchVPBB = getVectorLoopRegion()->getExitingBasicBlock(); BasicBlock *VectorLatchBB = State->CFG.VPBB2IRBB[LatchVPBB]; // Fix the latch value of canonical, reduction and first-order recurrences @@ -1187,8 +1187,8 @@ void VPlanPrinter::drawEdge(const VPBlockBase *From, const VPBlockBase *To, bool Hidden, const Twine &Label) { // Due to "dot" we print an edge between two regions as an edge between the - // exit basic block and the entry basic of the respective regions. - const VPBlockBase *Tail = From->getExitBasicBlock(); + // exiting basic block and the entry basic of the respective regions. + const VPBlockBase *Tail = From->getExitingBasicBlock(); const VPBlockBase *Head = To->getEntryBasicBlock(); OS << Indent << getUID(Tail) << " -> " << getUID(Head); OS << " [ label=\"" << Label << '\"'; diff --git a/llvm/lib/Transforms/Vectorize/VPlanHCFGBuilder.cpp b/llvm/lib/Transforms/Vectorize/VPlanHCFGBuilder.cpp --- a/llvm/lib/Transforms/Vectorize/VPlanHCFGBuilder.cpp +++ b/llvm/lib/Transforms/Vectorize/VPlanHCFGBuilder.cpp @@ -329,7 +329,7 @@ // 5. Final Top Region setup. Set outermost loop pre-header and single exit as // Top Region entry and exit. TopRegion->setEntry(PreheaderVPBB); - TopRegion->setExit(LoopExitVPBB); + TopRegion->setExiting(LoopExitVPBB); return TopRegion; } diff --git a/llvm/lib/Transforms/Vectorize/VPlanPredicator.cpp b/llvm/lib/Transforms/Vectorize/VPlanPredicator.cpp --- a/llvm/lib/Transforms/Vectorize/VPlanPredicator.cpp +++ b/llvm/lib/Transforms/Vectorize/VPlanPredicator.cpp @@ -130,9 +130,9 @@ // predecessor blocks. void VPlanPredicator::createOrPropagatePredicates(VPBlockBase *CurrBlock, VPRegionBlock *Region) { - // Blocks that dominate region exit inherit the predicate from the region. + // Blocks that dominate region exiting inherit the predicate from the region. // Return after setting the predicate. - if (VPDomTree.dominates(CurrBlock, Region->getExit())) { + if (VPDomTree.dominates(CurrBlock, Region->getExiting())) { VPValue *RegionBP = Region->getPredicate(); CurrBlock->setPredicate(RegionBP); return; diff --git a/llvm/lib/Transforms/Vectorize/VPlanVerifier.cpp b/llvm/lib/Transforms/Vectorize/VPlanVerifier.cpp --- a/llvm/lib/Transforms/Vectorize/VPlanVerifier.cpp +++ b/llvm/lib/Transforms/Vectorize/VPlanVerifier.cpp @@ -43,9 +43,9 @@ /// \p Region. Checks in this function are generic for VPBlockBases. They are /// not specific for VPBasicBlocks or VPRegionBlocks. static void verifyBlocksInRegion(const VPRegionBlock *Region) { - for (const VPBlockBase *VPB : - make_range(df_iterator::begin(Region->getEntry()), - df_iterator::end(Region->getExit()))) { + for (const VPBlockBase *VPB : make_range( + df_iterator::begin(Region->getEntry()), + df_iterator::end(Region->getExiting()))) { // Check block's parent. assert(VPB->getParent() == Region && "VPBlockBase has wrong parent"); @@ -94,13 +94,14 @@ /// VPBlockBases. Do not recurse inside nested VPRegionBlocks. static void verifyRegion(const VPRegionBlock *Region) { const VPBlockBase *Entry = Region->getEntry(); - const VPBlockBase *Exit = Region->getExit(); + const VPBlockBase *Exiting = Region->getExiting(); - // Entry and Exit shouldn't have any predecessor/successor, respectively. + // Entry and Exiting shouldn't have any predecessor/successor, respectively. assert(!Entry->getNumPredecessors() && "Region entry has predecessors."); - assert(!Exit->getNumSuccessors() && "Region exit has successors."); + assert(!Exiting->getNumSuccessors() && + "Region exiting block has successors."); (void)Entry; - (void)Exit; + (void)Exiting; verifyBlocksInRegion(Region); } @@ -111,9 +112,9 @@ verifyRegion(Region); // Recurse inside nested regions. - for (const VPBlockBase *VPB : - make_range(df_iterator::begin(Region->getEntry()), - df_iterator::end(Region->getExit()))) { + for (const VPBlockBase *VPB : make_range( + df_iterator::begin(Region->getEntry()), + df_iterator::end(Region->getExiting()))) { if (const auto *SubRegion = dyn_cast(VPB)) verifyRegionRec(SubRegion); } @@ -170,19 +171,19 @@ return false; } - const VPBasicBlock *Exit = dyn_cast(TopRegion->getExit()); - if (!Exit) { - errs() << "VPlan exit block is not a VPBasicBlock\n"; + const VPBasicBlock *Exiting = dyn_cast(TopRegion->getExiting()); + if (!Exiting) { + errs() << "VPlan exiting block is not a VPBasicBlock\n"; return false; } - if (Exit->empty()) { - errs() << "VPlan vector loop exit must end with BranchOnCount " + if (Exiting->empty()) { + errs() << "VPlan vector loop exiting block must end with BranchOnCount " "VPInstruction but is empty\n"; return false; } - auto *LastInst = dyn_cast(std::prev(Exit->end())); + auto *LastInst = dyn_cast(std::prev(Exiting->end())); if (!LastInst || LastInst->getOpcode() != VPInstruction::BranchOnCount) { errs() << "VPlan vector loop exit must end with BranchOnCount " "VPInstruction\n"; @@ -197,8 +198,8 @@ errs() << "region entry block has predecessors\n"; return false; } - if (Region->getExit()->getNumSuccessors() != 0) { - errs() << "region exit block has successors\n"; + if (Region->getExiting()->getNumSuccessors() != 0) { + errs() << "region exiting block has successors\n"; return false; } }