[llvm] [LV] Support masked interleaved access with gaps for scalable vector (PR #196479)

Mel Chen via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 1 06:58:16 PDT 2026


Mel-Chen wrote:

> Hi @Mel-Chen, this seems like a useful PR. Do you have any plans to progress this?

Apologies for the slow reply. I've been busy with downstream work.
I rebased the patch to show the issue I'm in the middle of fixing.
See `llvm/test/Transforms/LoopVectorize/RISCV/pointer-induction.ll`:
```
    INTERLEAVE-GROUP with factor 3, vp<%7>, vp<%evl>
      ir<%unused> = vp.load from index 0
      ir<%l> = vp.load from index 1
```
This patch might cause some regressions: previously we only compared gather vs. strided load costs, but now we also need to account for interleave cost. Since strided conversion currently happens at a stage where we only check `interleave cost <= 2 * gather cost` rather than `interleave cost <= 2 * strided load cost` (especially given this case only requires one load ultimately), the higher overall cost ends up blocking vectorization.

I'm implementing this TODO to eliminate the regression:
```
      // TODO: Transform interleave access into multiple strided accesses.
```

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


More information about the llvm-commits mailing list