[llvm] [RISCV] Convert -mtune=generic to generic-rv32/rv64 in RISCVSubtarget::initializeSubtargetDependencies. (PR #168612)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 18 14:00:11 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-risc-v
Author: Craig Topper (topperc)
<details>
<summary>Changes</summary>
The "generic" entry in tablegen is really a dummy entry. We shouldn't use it for anything. Remap "generic" to either generic-rv32 or generic-rv64 based on the triple.
---
Full diff: https://github.com/llvm/llvm-project/pull/168612.diff
1 Files Affected:
- (modified) llvm/lib/Target/RISCV/RISCVSubtarget.cpp (+2)
``````````diff
diff --git a/llvm/lib/Target/RISCV/RISCVSubtarget.cpp b/llvm/lib/Target/RISCV/RISCVSubtarget.cpp
index 926cc9ea547a6..f86265a21d17e 100644
--- a/llvm/lib/Target/RISCV/RISCVSubtarget.cpp
+++ b/llvm/lib/Target/RISCV/RISCVSubtarget.cpp
@@ -88,6 +88,8 @@ RISCVSubtarget::initializeSubtargetDependencies(const Triple &TT, StringRef CPU,
if (TuneCPU.empty())
TuneCPU = CPU;
+ if (TuneCPU == "generic")
+ TuneCPU = Is64Bit ? "generic-rv64" : "generic-rv32";
TuneInfo = RISCVTuneInfoTable::getRISCVTuneInfo(TuneCPU);
// If there is no TuneInfo for this CPU, we fail back to generic.
``````````
</details>
https://github.com/llvm/llvm-project/pull/168612
More information about the llvm-commits
mailing list