[llvm] [VPlan] Dissolve replicate regions with vector live-outs. (PR #189022)

via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 4 10:28:38 PDT 2026


================
@@ -786,10 +786,20 @@ static void dissolveReplicateRegion(VPRegionBlock *Region, ElementCount VF,
   // single-scalar.
   convertRecipesInRegionBlocksToSingleScalar(Plan, IdxTy, FirstLaneEntry, VF);
 
+  // For scalar VF, just wire the blocks and return; no cloning or packing
+  // needed.
+  if (VF.isScalar()) {
+    VPBlockUtils::connectBlocks(Predecessor, FirstLaneEntry);
+    VPBlockUtils::connectBlocks(FirstLaneExiting, Successor);
+    return;
+  }
+
   // Clone converted blocks for remaining lanes and process each in reverse
   // order, connecting each lane's Exiting block to the subsequent lane's entry.
   VPBlockBase *NextLaneEntry = Successor;
   unsigned NumLanes = VF.getFixedValue();
+  SmallVector<VPBasicBlock *> ExitingBlocks(NumLanes);
----------------
ayalz wrote:

Can the phi's be recorded directly, skipping the recording of ExistingBlocks - each phi knows its parent, and LastExit can be retrieved as the predecessor of Successor, or BuildStructVector can be placed at the beginning of Successor rather than end of its (to be merged into) predecessor.

https://github.com/llvm/llvm-project/pull/189022


More information about the llvm-commits mailing list