[llvm] [VPlan] Add VPlan-based addMinIterCheck, replace ILV for non-epilogue. (PR #153643)

via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 21 08:46:02 PDT 2025


================
@@ -9363,6 +9304,28 @@ void LoopVectorizationPlanner::attachRuntimeChecks(
   }
 }
 
+void LoopVectorizationPlanner::addMinimumIterationCheck(
+    VPlan &Plan, ElementCount VF, unsigned UF,
+    ElementCount MinProfitableTripCount) const {
+  // vscale is not necessarily a power-of-2, which means we cannot guarantee
+  // an overflow to zero when updating induction variables and so an
+  // additional overflow check is required before entering the vector loop.
+  bool CheckNeededWithTailFolding =
----------------
ayalz wrote:

```suggestion
  bool isIndvarOverflowCheckNeededForVF =
```
? Consistent with `isIndvarOverflowCheckKnownFalse()` and specific to VF; note that UF is also not necessarily a power-of-2, perhaps worth handling as well the same way?
Then maybe `indvarBumpMayOverflow` is clearer.

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


More information about the llvm-commits mailing list