[llvm] [RISCV] Disable use of scalable vectors for VLEN=32 (PR #185553)
Shih-Po Hung via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 9 19:02:51 PDT 2026
https://github.com/arcbbb created https://github.com/llvm/llvm-project/pull/185553
This patch prevents the loop vectorizer to choose scalable vector type when target VLEN is less than RVVBitsPerkBlock.
>From a4d9c58c5d8b00522b0a0abf02866d08359a388d Mon Sep 17 00:00:00 2001
From: ShihPo Hung <shihpo.hung at sifive.com>
Date: Mon, 9 Mar 2026 18:56:11 -0700
Subject: [PATCH] [RISCV] Disable use of scalable vectors for VLEN=32
This patch prevents the loop vectorizer to choose scalable vector type
when target VLen is less than RVVBitsPerkBlock.
---
llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
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 {
More information about the llvm-commits
mailing list