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

Cameron McInally via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 18 11:37:52 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());
+
----------------
mcinally 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?

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


More information about the llvm-commits mailing list