[llvm] [VPlan] Enable vectorization of early-exit loops with unit-stride fault-only-first loads (PR #151300)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 12 06:53:15 PST 2026


================
@@ -399,6 +399,12 @@ static cl::opt<bool> EnableEarlyExitVectorization(
     cl::desc(
         "Enable vectorization of early exit loops with uncountable exits."));
 
+static cl::opt<bool>
+    EnableEarlyExitWithFFLoads("enable-early-exit-with-ffload", cl::init(false),
----------------
lukel97 wrote:

In theory other targets can expand vp.load.ff so it just loads one element at a time, see #154440. But I'm not sure if this is worthwhile doing, since we'll never actually want to generate this code in practice. Targets should just return an invalid cost otherwise.

For SVE I presume we will need a second first-faulting/fault-only-first intrinsic because ldff1 sets a predicate register right?

I'm imagining we'll need something separate like `{<vscale x 2 x i64>, <vscale x 2 x i1>} llvm.masked.ff.load(ptr %p, <vscale x 2 x i1>)`.

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


More information about the llvm-commits mailing list