[llvm] [LV] Convert scatter stores with constant stride into strided stores (PR #206896)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 16 00:21:29 PDT 2026


lukel97 wrote:

> I think there's some regressions where we're no longer matching interleaved accesses, e.g. this used to be a vsseg but now it's 5 vsses.
> 
> ```c
> long p[1024 * 5];
> 
> void foo(long *p) {
>   for (long i = 0; i < 1024; i++) {
>     p[5 * i]     += 1;
>     p[5 * i + 1] += 2;
>     p[5 * i + 2] += 3;
>     p[5 * i + 3] += 4;
>     p[5 * i + 4] += 5;
>   }
> }
> ```
> 
> My guess is that loop vectorizer wasn't interleaving these originally but then the interleaved access pass was handling them? But I'm not sure why we weren't doing the interleaving in VPlan to begin with. We run createInterleaveGroups before convertToStridedAccesses.

After some benchmarking on the spacemit-x60 and spacemit-x100, it turns out that the 5 vsse64.v s is actually more performant because it's at LMUL 2, whereas with vseg5e64 you're limited to LMUL 1 (LMUL > 1 is reserved with NF > 4).

So I don't think this is blocking anymore, I'm happy to move ahead with this patch



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


More information about the llvm-commits mailing list