[llvm] [RISCV] Disable use of scalable vectors for VLEN=32 (PR #185553)

via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 9 19:03:25 PDT 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-risc-v

Author: Shih-Po Hung (arcbbb)

<details>
<summary>Changes</summary>

This patch prevents the loop vectorizer to choose scalable vector type when target VLEN is less than RVVBitsPerkBlock.

---
Full diff: https://github.com/llvm/llvm-project/pull/185553.diff


1 Files Affected:

- (modified) llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h (+3-1) 


``````````diff
diff --git a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h
index cee41b1422b85..5fed0a5b37cf9 100644
--- a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h
+++ b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h
@@ -113,7 +113,9 @@ class RISCVTTIImpl final : public BasicTTIImplBase<RISCVTTIImpl> {
 
   bool shouldExpandReduction(const IntrinsicInst *II) const override;
   bool supportsScalableVectors() const override {
-    return ST->hasVInstructions();
+    // VLEN=32 support is incomplete.
+    return ST->hasVInstructions() &&
+           (ST->getRealMinVLen() >= RISCV::RVVBitsPerBlock);
   }
   bool enableOrderedReductions() const override { return true; }
   bool enableScalableVectorization() const override {

``````````

</details>


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


More information about the llvm-commits mailing list