[clang] [LTO] Fix Veclib flags correctly pass to LTO flags (PR #78749)

Paschalis Mpeis via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 22 03:49:30 PST 2024


================
@@ -783,6 +783,28 @@ void tools::addLTOOptions(const ToolChain &ToolChain, const ArgList &Args,
                                          "-generate-arange-section"));
   }
 
+  // Pass vector library arguments to LTO.
+  Arg *ArgVecLib = Args.getLastArg(options::OPT_fveclib);
+  if (ArgVecLib && ArgVecLib->getNumValues() == 1) {
+    // Map the vector library names from clang front-end to opt front-end. The
+    // values are taken from the TargetLibraryInfo class command line options.
+    std::optional<StringRef> OptVal =
+        llvm::StringSwitch<std::optional<StringRef>>(ArgVecLib->getValue())
----------------
paschalis-mpeis wrote:

Reusing code for mapping the strings is a great suggestion, however, `TargetLibraryInfo` statically creates some `cl::opt` (command line options) and I'm not sure ATM what would be a clean way to do this.

I would suggest such change (if is doable in a clean way) to be dealt in a separate patch.


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


More information about the cfe-commits mailing list