[llvm] [MC] Add support for -mcpu=native. (PR #159414)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 19 09:27:13 PDT 2025


================
@@ -467,6 +467,10 @@ int main(int argc, char **argv) {
     FeaturesStr = Features.getString();
   }
 
+  // Replace -mcpu=native with Host CPU.
+  if (MCPU == "native")
+    MCPU = std::string(llvm::sys::getHostCPUName());
+
----------------
topperc wrote:

> Latest patch addresses this. I think it's best to allow the command line -mattr's to override the default with native, but I don't feel strongly about it. Thoughts?

I agree.

https://github.com/llvm/llvm-project/pull/159414


More information about the llvm-commits mailing list