[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 =
+      VF.isScalable() && !TTI.isVScaleKnownToBeAPowerOfTwo() &&
+      !isIndvarOverflowCheckKnownFalse(&CM, VF, 1) &&
----------------
ayalz wrote:

Better pass UF instead of 1?

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


More information about the llvm-commits mailing list