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

David Sherwood via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 22 01:38:56 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())
----------------
david-arm wrote:

Is it possible to refactor and reuse existing TargetLibraryInfo code, i.e. create a common static function that maps the values so that it can be called in multiple places?

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


More information about the cfe-commits mailing list