[llvm] [VPlan] Make CanIV part of region. (PR #144803)

via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 10 05:12:54 PDT 2025


================
@@ -9742,19 +9739,18 @@ preparePlanForEpilogueVectorLoop(VPlan &Plan, Loop *L,
   Header->setName("vec.epilog.vector.body");
 
   DenseMap<Value *, Value *> ToFrozen;
-  // Ensure that the start values for all header phi recipes are updated before
-  // vectorizing the epilogue loop.
-  for (VPRecipeBase &R : Header->phis()) {
-    if (auto *IV = dyn_cast<VPCanonicalIVPHIRecipe>(&R)) {
-      // When vectorizing the epilogue loop, the canonical induction start
-      // value needs to be changed from zero to the value after the main
-      // vector loop. Find the resume value created during execution of the main
-      // VPlan.
-      // FIXME: Improve modeling for canonical IV start values in the epilogue
-      // loop.
-      using namespace llvm::PatternMatch;
-      Type *IdxTy = IV->getScalarType();
-      PHINode *EPResumeVal = find_singleton<PHINode>(
+
+  auto *IV = Plan.getCanonicalIV();
+  // When vectorizing the epilogue loop, the canonical induction start
+  // value needs to be changed from zero to the value after the main
+  // vector loop. Find the resume value created during execution of the main
+  // VPlan.
+  // FIXME: Improve modeling for canonical IV start values in the epilogue
+  // loop.
----------------
ayalz wrote:

```suggestion
  // When vectorizing the epilogue loop, the canonical induction start value
  // needs to be changed from zero to the value after the main vector loop. Find
  // the resume value created during execution of the main VPlan.
  // FIXME: Improve modeling for canonical IV start values in the epilogue loop.
```

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


More information about the llvm-commits mailing list