[llvm-branch-commits] [llvm] [RISCV] Remove getMaxLMULForFixedLengthVectors. NFC (PR #226111)
Luke Lau via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Sep 24 03:49:25 PDT 2026
https://github.com/lukel97 created https://github.com/llvm/llvm-project/pull/226111
The value can no longer be overridden after https://github.com/llvm/llvm-project/pull/207312. Now there's nothing specific about it to fixed vectors, so just inline it.
---
<sub>Stack created with <a href="https://github.com/github/gh-stack">GitHub Stacks CLI</a> • <a href="https://gh.io/stacks-feedback">Give Feedback 💬</a></sub>
>From 7a19120019ba1c5a933194328608dea05bb315e6 Mon Sep 17 00:00:00 2001
From: Luke Lau <luke at igalia.com>
Date: Thu, 24 Sep 2026 11:47:17 +0100
Subject: [PATCH] [RISCV] Remove getMaxLMULForFixedLengthVectors. NFC
The value can no longer be overridden after https://github.com/llvm/llvm-project/pull/207312. Now there's nothing specific about it to fixed vectors, so just inline it.
---
llvm/lib/Target/RISCV/RISCVISelLowering.cpp | 6 ++----
llvm/lib/Target/RISCV/RISCVSubtarget.cpp | 6 ------
llvm/lib/Target/RISCV/RISCVSubtarget.h | 1 -
llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp | 2 +-
4 files changed, 3 insertions(+), 12 deletions(-)
diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
index d4ce17dd45a49c..e6c94fc9fc22c5 100644
--- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -3385,7 +3385,7 @@ static bool useRVVForFixedLengthVectorVT(MVT VT,
unsigned LMul = divideCeil(VT.getSizeInBits(), MinVLen);
// Don't use RVV for types that don't fit.
- if (LMul > Subtarget.getMaxLMULForFixedLengthVectors())
+ if (LMul > 8)
return false;
// TODO: Perhaps an artificial restriction, but worth having whilst getting
@@ -20248,9 +20248,7 @@ combineVectorSizedSetCCEquality(EVT VT, SDValue X, SDValue Y, ISD::CondCode CC,
unsigned OpSize = OpVT.getSizeInBits();
// The size should be larger than XLen and smaller than the maximum vector
// size.
- if (OpSize <= Subtarget.getXLen() ||
- OpSize > Subtarget.getRealMinVLen() *
- Subtarget.getMaxLMULForFixedLengthVectors())
+ if (OpSize <= Subtarget.getXLen() || OpSize > Subtarget.getRealMinVLen() * 8)
return SDValue();
// Don't perform this combine if constructing the vector will be expensive.
diff --git a/llvm/lib/Target/RISCV/RISCVSubtarget.cpp b/llvm/lib/Target/RISCV/RISCVSubtarget.cpp
index 02e9f1f412ab3b..747e10152ddf66 100644
--- a/llvm/lib/Target/RISCV/RISCVSubtarget.cpp
+++ b/llvm/lib/Target/RISCV/RISCVSubtarget.cpp
@@ -261,12 +261,6 @@ unsigned RISCVSubtarget::getMinRVVVectorSizeInBits() const {
return RVVVectorBitsMin;
}
-unsigned RISCVSubtarget::getMaxLMULForFixedLengthVectors() const {
- assert(hasVInstructions() &&
- "Tried to get vector length without Zve or V extension support!");
- return 8;
-}
-
bool RISCVSubtarget::useRVVForFixedLengthVectors() const {
return hasVInstructions() &&
getMinRVVVectorSizeInBits() >= RISCV::RVVBitsPerBlock;
diff --git a/llvm/lib/Target/RISCV/RISCVSubtarget.h b/llvm/lib/Target/RISCV/RISCVSubtarget.h
index fcb4ea2b6635b2..759de71827a774 100644
--- a/llvm/lib/Target/RISCV/RISCVSubtarget.h
+++ b/llvm/lib/Target/RISCV/RISCVSubtarget.h
@@ -390,7 +390,6 @@ class RISCVSubtarget : public RISCVGenSubtargetInfo {
unsigned getMispredictionPenalty() const override;
unsigned getLoadLatency() const override;
- unsigned getMaxLMULForFixedLengthVectors() const;
bool useRVVForFixedLengthVectors() const;
bool enableSubRegLiveness() const override;
diff --git a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
index 72803cf7351594..e168a1036bc656 100644
--- a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
+++ b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
@@ -3733,7 +3733,7 @@ RISCVTTIImpl::enableMemCmpExpansion(bool OptSize, bool IsZeroCmp) const {
// The minimum size should be `XLen / 8 + 1`, and the maxinum size should be
// `VLenB * MaxLMUL` so that it fits in a single register group.
unsigned MinSize = ST->getXLen() / 8 + 1;
- unsigned MaxSize = VLenB * ST->getMaxLMULForFixedLengthVectors();
+ unsigned MaxSize = VLenB * 8;
for (unsigned Size = MinSize; Size <= MaxSize; Size++)
Options.LoadSizes.insert(Options.LoadSizes.begin(), Size);
}
More information about the llvm-branch-commits
mailing list