[llvm] [LoopVectorize] Enable vectorization of uncountable loops with invariant bound loads via speculative hoisting and runtime versioning. (PR #195027)

Ashutosh Nema via llvm-commits llvm-commits at lists.llvm.org
Thu May 7 10:42:55 PDT 2026


================
@@ -8163,6 +8164,201 @@ static void connectEpilogueVectorLoop(VPlan &EpiPlan, Loop *L,
       Phi.eraseFromParent();
 }
 
+// Is profitable to generate runtime check dominated version of the loop? which
+// has speculatively hoisted the loop bound load.
+static bool isSpeculativeBoundVersioningProfitable() { return true; }
+
+/*
+
+              preheader
+                |
+              rtcheck-block
+                /  \
+               /    \
+        for.preheader    ver.preheader
+            |               |
+         for.body       ver.for.body
+
+*/
+static Loop *tryToVersionLoopForInvariantBoundLoad(
----------------
nema-ashutosh wrote:

If we introduce this as a part of loop-versioning utility, the applicability will get wider ?

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


More information about the llvm-commits mailing list