[llvm] [LV][RISCV] Add explicit LMUL controls via computeFeasibleMaxVF (PR #193091)

Shih-Po Hung via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 27 02:54:32 PDT 2026


arcbbb wrote:

> But both end up controlling the maximum LMUL used for loop vectorization right? Is there a particular scenario where `riscv-v-register-bit-width-lmul` doesn't work?

I'm trying to understand the RISC-V implementation of `getRegisterBitWidth`.
Currently, RISC-V implements it as `LMUL × RVVBitsPerBlock`, which works well for the LoopVectorizer's MaxVF computation:
```
  MaxVF = RegisterBitWidth / WidestType
        = (LMUL × RVVBitsPerBlock) / WidestType
```
However, given the API documentation, I'm unclear whether this should return `LMUL × RealMinVLen` instead?
```
  /// \return The width of the largest scalar or vector register type.
  LLVM_ABI TypeSize getRegisterBitWidth(RegisterKind K) const;
```


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


More information about the llvm-commits mailing list