[llvm] ada2a45 - [VPlan] Use VPBasicBlock to get incoming block for exit phi fixup (NFC)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 17 10:18:09 PDT 2023


Author: Florian Hahn
Date: 2023-08-17T18:17:45+01:00
New Revision: ada2a455fca47be74ef4394c5aba475887af3f8c

URL: https://github.com/llvm/llvm-project/commit/ada2a455fca47be74ef4394c5aba475887af3f8c
DIFF: https://github.com/llvm/llvm-project/commit/ada2a455fca47be74ef4394c5aba475887af3f8c.diff

LOG: [VPlan] Use VPBasicBlock to get incoming block for exit phi fixup (NFC)

Retrieve block via VPlan infrastructure as suggested as independent
cleanup in D150398.

Added: 
    

Modified: 
    llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
index 14b19a2031ddf5..83392ae376a895 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
@@ -156,8 +156,13 @@ void VPLiveOut::fixPhi(VPlan &Plan, VPTransformState &State) {
   VPValue *ExitValue = getOperand(0);
   if (vputils::isUniformAfterVectorization(ExitValue))
     Lane = VPLane::getFirstLane();
+  VPBasicBlock *MiddleVPBB =
+      cast<VPBasicBlock>(Plan.getVectorLoopRegion()->getSingleSuccessor());
+  assert(MiddleVPBB->getNumSuccessors() == 0 &&
+         "the middle block must not have any successors");
+  BasicBlock *MiddleBB = State.CFG.VPBB2IRBB[MiddleVPBB];
   Phi->addIncoming(State.get(ExitValue, VPIteration(State.UF - 1, Lane)),
-                   State.Builder.GetInsertBlock());
+                   MiddleBB);
 }
 
 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)


        


More information about the llvm-commits mailing list