[llvm] b5d43f7 - [VPlan] Use transferSuccessors in mergeBlocksIntoPredecessors (NFC). (#189275)

via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 29 12:20:28 PDT 2026


Author: Florian Hahn
Date: 2026-03-29T20:20:23+01:00
New Revision: b5d43f7794f9ec2fdf0e503ca34ef8e487d9b7e3

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

LOG: [VPlan] Use transferSuccessors in mergeBlocksIntoPredecessors (NFC). (#189275)

transferSuccessors is more compact and is guaranteed to preserve the
predecessor/successor order properly in all cases. This is not an issue
today, but will when used in more places, including #186252.

Split off from approved
https://github.com/llvm/llvm-project/pull/186252.

PR: https://github.com/llvm/llvm-project/pull/189275

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp b/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
index aab97537d5522..fbe821da37188 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
@@ -597,10 +597,7 @@ bool VPlanTransforms::mergeBlocksIntoPredecessors(VPlan &Plan) {
     auto *ParentRegion = VPBB->getParent();
     if (ParentRegion && ParentRegion->getExiting() == VPBB)
       ParentRegion->setExiting(PredVPBB);
-    for (auto *Succ : to_vector(VPBB->successors())) {
-      VPBlockUtils::disconnectBlocks(VPBB, Succ);
-      VPBlockUtils::connectBlocks(PredVPBB, Succ);
-    }
+    VPBlockUtils::transferSuccessors(VPBB, PredVPBB);
     // VPBB is now dead and will be cleaned up when the plan gets destroyed.
   }
   return !WorkList.empty();


        


More information about the llvm-commits mailing list