[PATCH] D65532: [LTO][Legacy] Update TargetOption after parsing debug options

Steven Wu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 31 13:06:30 PDT 2019


steven_wu created this revision.
steven_wu added reviewers: tejohnson, bd1976llvm.
Herald added subscribers: dexonsmith, jkorous, inglorion, mehdi_amini.
Herald added a project: LLVM.

The current libLTO implementation sets up the TargetOption for the
CodeGenerator when the CodeGenerator is created. That is before the
codegen commandline options are parsed because lto_codegen_debug_options
API takes CodeGenerator as a parameter. That causes the codegen options
(e.g. -tailcallopt) passing through lto_codegen_debug_options has no effect.
Fix the issue by updating TargetOptions after parsing commandline
options.

rdar://problem/53595173


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D65532

Files:
  llvm/tools/lto/lto.cpp


Index: llvm/tools/lto/lto.cpp
===================================================================
--- llvm/tools/lto/lto.cpp
+++ llvm/tools/lto/lto.cpp
@@ -407,6 +407,8 @@
 static void maybeParseOptions(lto_code_gen_t cg) {
   if (!parsedOptions) {
     unwrap(cg)->parseCodeGenDebugOptions();
+    // update the TargetOptions after parsing the debug options.
+    unwrap(cg)->setTargetOptions(InitTargetOptionsFromCodeGenFlags());
     lto_add_attrs(cg);
     parsedOptions = true;
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65532.212645.patch
Type: text/x-patch
Size: 488 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190731/a3d069f2/attachment-0001.bin>


More information about the llvm-commits mailing list