[clang] [llvm] [RISCV] Add support for getHostCPUFeatures using hwprobe (PR #94352)
Yingwei Zheng via cfe-commits
cfe-commits at lists.llvm.org
Sun Jul 14 21:59:30 PDT 2024
================
@@ -290,8 +290,24 @@ std::string riscv::getRISCVArch(const llvm::opt::ArgList &Args,
// 2. Get march (isa string) based on `-mcpu=`
if (const Arg *A = Args.getLastArg(options::OPT_mcpu_EQ)) {
StringRef CPU = A->getValue();
- if (CPU == "native")
+ if (CPU == "native") {
CPU = llvm::sys::getHostCPUName();
+ // If the target cpu is unrecognized, use target features.
+ if (CPU.empty() || CPU.starts_with("generic")) {
----------------
dtcxzyw wrote:
Done.
https://github.com/llvm/llvm-project/pull/94352
More information about the cfe-commits
mailing list