[llvm] [VPlan] Split out adding canonical IV recipes to separate transform. (PR #197541)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Thu May 14 05:06:23 PDT 2026


================
@@ -478,13 +478,14 @@ static void createLoopRegion(VPlan &Plan, VPBlockBase *HeaderVPB) {
     VPBB->setParent(R);
 }
 
-// Add the necessary canonical IV and branch recipes required to control the
-// loop.
-static void addCanonicalIVRecipes(VPlan &Plan, VPBasicBlock *HeaderVPBB,
-                                  VPBasicBlock *LatchVPBB, Type *IdxTy,
-                                  DebugLoc DL) {
+void VPlanTransforms::addCanonicalIVRecipes(VPlan &Plan, DebugLoc DL) {
+  auto *HeaderVPBB = cast<VPBasicBlock>(
+      Plan.getEntry()->getSuccessors()[1]->getSingleSuccessor());
----------------
lukel97 wrote:

I think we're doing this in a few places now, maybe we should add `findVectorHeader`/`findVectorLatch` helpers in VPlanConstruction

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


More information about the llvm-commits mailing list