[llvm] [VPlan] Set predecessor of DispatchVPBB early (NFC). (PR #195480)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Sat May 2 13:24:32 PDT 2026


https://github.com/fhahn created https://github.com/llvm/llvm-project/pull/195480

This allows finding the containing plan earlier, which helps when trying to print DispatchVPBB in a debugger.

>From 74a8f39aafdfea1d93df9b65b0ddbb51ca7f84ee Mon Sep 17 00:00:00 2001
From: Florian Hahn <flo at fhahn.com>
Date: Sat, 2 May 2026 20:54:44 +0100
Subject: [PATCH] [VPlan] Set predecessor of DispatchVPBB early (NFC).

This allows finding the containing plan earlier, which helps when trying
to print DispatchVPBB in a debugger.
---
 llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp b/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
index 9b34bd1f092a0..df7f23467b4c5 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
@@ -4164,6 +4164,7 @@ void VPlanTransforms::handleUncountableEarlyExits(VPlan &Plan,
   VPBasicBlock *DispatchVPBB =
       Exits.size() == 1 ? VectorEarlyExitVPBBs[0]
                         : Plan.createVPBasicBlock("vector.early.exit.check");
+  DispatchVPBB->setPredecessors({LatchVPBB});
   VPBuilder DispatchBuilder(DispatchVPBB, DispatchVPBB->begin());
   VPValue *FirstActiveLane =
       DispatchBuilder.createNaryOp(VPInstruction::FirstActiveLane, {Combined},
@@ -4286,7 +4287,6 @@ void VPlanTransforms::handleUncountableEarlyExits(VPlan &Plan,
                        {IsAnyExitTaken, IsLatchExitTaken}, LatchDL);
   LatchVPBB->clearSuccessors();
   LatchVPBB->setSuccessors({DispatchVPBB, MiddleVPBB, HeaderVPBB});
-  DispatchVPBB->setPredecessors({LatchVPBB});
 }
 
 /// This function tries convert extended in-loop reductions to



More information about the llvm-commits mailing list