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

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 23 00:56:05 PDT 2026


================
@@ -340,6 +348,24 @@ RISCVTTIImpl::getPopcntSupport(unsigned TyWidth) const {
   return ST->hasCPOPLike() ? TTI::PSK_FastHardware : TTI::PSK_Software;
 }
 
+std::optional<ElementCount>
+RISCVTTIImpl::getMaxScalableVF(unsigned MaxWidthInBits) const {
+  if (MaxWidthInBits > ST->getELen() ||
+      (ST->getRealMinVLen() < RISCV::RVVBitsPerBlock))
+    return ElementCount::get(0, false);
+
+  MaxWidthInBits = std::max<unsigned>(8, MaxWidthInBits);
----------------
topperc wrote:

```suggestion
  MaxWidthInBits = std::max(8U, MaxWidthInBits);
```

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


More information about the llvm-commits mailing list