[llvm] 429e315 - [RISCV] Convert -mtune=generic to generic-rv32/rv64 in RISCVSubtarget::initializeSubtargetDependencies. (#168612)

via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 19 00:08:28 PST 2025


Author: Craig Topper
Date: 2025-11-19T00:08:24-08:00
New Revision: 429e3156c8043ca30d5866755ad790314a26670f

URL: https://github.com/llvm/llvm-project/commit/429e3156c8043ca30d5866755ad790314a26670f
DIFF: https://github.com/llvm/llvm-project/commit/429e3156c8043ca30d5866755ad790314a26670f.diff

LOG: [RISCV] Convert -mtune=generic to generic-rv32/rv64 in RISCVSubtarget::initializeSubtargetDependencies. (#168612)

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.

Added: 
    

Modified: 
    llvm/lib/Target/RISCV/RISCVSubtarget.cpp

Removed: 
    


################################################################################
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.


        


More information about the llvm-commits mailing list