[clang] [llvm] [LoongArch] add la v1.1 features for sys::getHostCPUFeatures (PR #115832)

via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 12 22:49:28 PST 2024


================
@@ -135,8 +135,13 @@ void loongarch::getLoongArchTargetFeatures(const Driver &D,
     Features.push_back("+lsx");
 
   std::string ArchName;
-  if (const Arg *A = Args.getLastArg(options::OPT_march_EQ))
+  if (const Arg *A = Args.getLastArg(options::OPT_march_EQ)) {
     ArchName = A->getValue();
+    if (ArchName == "native")
+      for (auto &F : llvm::sys::getHostCPUFeatures())
+        Features.push_back(
----------------
tangaac wrote:

ArchName `"native"` will be lost after `postProcessTargetCPUString(ArchName, Triple);`

It needs to make a copy of `"native"` or use the original `A->getValue()`  after `getHostCPUFeatures`

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


More information about the cfe-commits mailing list