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

Lu Weining via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 13 02:08:09 PST 2024


================
@@ -135,10 +136,15 @@ void loongarch::getLoongArchTargetFeatures(const Driver &D,
     Features.push_back("+lsx");
 
   std::string ArchName;
-  if (const Arg *A = Args.getLastArg(options::OPT_march_EQ))
-    ArchName = A->getValue();
+  const Arg *MArch = Args.getLastArg(options::OPT_march_EQ);
+  if (MArch)
+    ArchName = MArch->getValue();
   ArchName = postProcessTargetCPUString(ArchName, Triple);
   llvm::LoongArch::getArchFeatures(ArchName, Features);
+  if ((std::string)(MArch->getValue()) == "native")
----------------
SixWeining wrote:

```suggestion
  if (MArch && StringRef(MArch->getValue()) == "native")
```

Similar to https://github.com/llvm/llvm-project/blob/main/clang/lib/Driver/ToolChains/Arch/AArch64.cpp#L463

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


More information about the cfe-commits mailing list