[llvm] [VPlan] Connect Entry to scalar preheader during initial construction. (PR #140132)

via llvm-commits llvm-commits at lists.llvm.org
Tue May 20 12:52:23 PDT 2025


================
@@ -558,6 +561,9 @@ void VPlanTransforms::prepareForVectorization(
   // The connection order corresponds to the operands of the conditional branch,
   // with the middle block already connected to the exit block.
   VPBlockUtils::connectBlocks(MiddleVPBB, ScalarPH);
+  // Also connect the entry block to the scalar preheader.
+  VPBlockUtils::connectBlocks(Plan.getEntry(), ScalarPH);
----------------
ayalz wrote:

The CFG is less consistent with VPlan's recipes, connecting entry VPBB to scalarPH VPBB now, when it is already connected to vectorPH, w/o introducing a conditional branch recipe at the end of entry - the branch instruction is generated outside VPlan's execute.

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


More information about the llvm-commits mailing list