[flang-commits] [clang] [flang] [mlir] [flang] Add basic -mtune support (PR #95043)

Tarun Prabhu via flang-commits flang-commits at lists.llvm.org
Tue Jun 11 08:49:10 PDT 2024


================
@@ -411,6 +412,13 @@ void Flang::addTargetOptions(const ArgList &Args,
   }
 
   // TODO: Add target specific flags, ABI, mtune option etc.
+  if (const Arg *A = Args.getLastArg(options::OPT_mtune_EQ)) {
+    CmdArgs.push_back("-tune-cpu");
+    if (strcmp(A->getValue(), "native") == 0)
----------------
tarunprabhu wrote:

`A` is an `llvm::Arg`. The `getValue()` method [returns](https://llvm.org/doxygen/classllvm_1_1opt_1_1Arg.html#ac268590692356db84db78050196b4940) a `const char*`, so unless it is wrapped in a `llvm::StringRef`, the `==` operator cannot be used for string comparison.

It is surprising though. I, too, would have expected it to return a `llvm::StringRef`.

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


More information about the flang-commits mailing list