[llvm] [RISCV] Enabled masked interleaved access (PR #149981)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 23 01:02:14 PDT 2025


================
@@ -1358,7 +1358,9 @@ class LoopVectorizationCostModel {
       return;
     // Override forced styles if needed.
     // FIXME: Investigate opportunity for fixed vector factor.
+    // FIXME: Support interleave accesses.
     bool EVLIsLegal = UserIC <= 1 && IsScalableVF &&
+                      !InterleaveInfo.hasGroups() &&
----------------
lukel97 wrote:

IIUC the mask is interleaved with itself before being fed into the widen load, i.e. see these lines: https://github.com/llvm/llvm-project/pull/150074/files#diff-8b722352f6c665b720f4318006f7ae773cfaddd722fd211fdcf8ef18d8d115dcR42-R43

So the widen load's mask is actually `interleave([T, T, T, F], [T, T, T, F]) = [T, T, T, T, T, T, F, F]` on the first iteration, and `interleave([T, T, F, F], [T, T, F, F]) = [T, T, T, T, F, F, F, F]` on the second iteration

The interleaved access pass then checks to make sure that the mask is actually interleaved before deinterleaving it again for the vlseg/vsseg intrinsic: 

https://github.com/llvm/llvm-project/blob/b7889a65a8e54f2d9c7f578a515a7bf970044bfe/llvm/lib/CodeGen/InterleavedAccessPass.cpp#L536-L543

So it should emit a vlseg with mask `[T, T, T, F]` on the first iteration, and `[T, T, F, F]` on the second iteration

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


More information about the llvm-commits mailing list