[llvm] [VPlan] Introduce child regions as VPlan transform. (PR #129402)

via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 7 02:20:47 PDT 2025


================
@@ -14,26 +14,61 @@
 #include "LoopVectorizationPlanner.h"
 #include "VPlan.h"
 #include "VPlanCFG.h"
+#include "VPlanDominatorTree.h"
 #include "VPlanTransforms.h"
 #include "llvm/Analysis/LoopInfo.h"
 #include "llvm/Analysis/ScalarEvolution.h"
 
 using namespace llvm;
 
-void VPlanTransforms::introduceTopLevelVectorLoopRegion(
-    VPlan &Plan, Type *InductionTy, PredicatedScalarEvolution &PSE,
-    bool RequiresScalarEpilogueCheck, bool TailFolded, Loop *TheLoop) {
-  // TODO: Generalize to introduce all loop regions.
-  auto *HeaderVPBB = cast<VPBasicBlock>(Plan.getEntry()->getSingleSuccessor());
-  VPBlockUtils::disconnectBlocks(Plan.getEntry(), HeaderVPBB);
+/// Create and return a new VPRegionBlock for loop starting at \p HeaderVPBB and
+/// return it.
+static VPRegionBlock *introduceRegion(VPlan &Plan, VPBasicBlock *PreheaderVPBB,
+                                      VPBasicBlock *HeaderVPBB,
+                                      VPBasicBlock *LatchVPBB) {
----------------
ayalz wrote:

Suffice to receive PreheaderVPBB, as HeaderVPBB must be its single successor and LatchVPBB must be the latter's other predecessor. Or HeaderVPBB, if its predecessors order is already canonicalized.

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


More information about the llvm-commits mailing list