[PATCH] D19015: [LTO] hook up lto_codegen_debug_options() to codegen target options

Thomas Guest via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 12 08:37:23 PDT 2016


thomasguest created this revision.
thomasguest added reviewers: rafael, pcc.
thomasguest added a subscriber: llvm-commits.
Herald added a subscriber: joker.eph.

This change allows users of the LTO library to configure the codegen using the lto_codegen_debug_options() function, for example to set option "-function-sections". Without this change, options passed in via lto_codegen_debug_options() are parsed but not applied during compilation.

I would like advice on how to write tests for this change.

It would be possible to create unit tests in llvm/unittests/LTO, but I can find no examples of unit tests written against code in the llvm/tools directory.

The alternative would be to write a lit system test against one of the tools. In this case the obvious candidate tool is llvm-lto. However this tool does not call lto_codegen_debug_options(), and I cannot find a way to validate the change in behaviour this change introduces.


http://reviews.llvm.org/D19015

Files:
  tools/lto/lto.cpp

Index: tools/lto/lto.cpp
===================================================================
--- tools/lto/lto.cpp
+++ tools/lto/lto.cpp
@@ -383,6 +383,8 @@
   if (!parsedOptions) {
     unwrap(cg)->parseCodeGenDebugOptions();
     lto_add_attrs(cg);
+    TargetOptions Options = InitTargetOptionsFromCodeGenFlags();
+    unwrap(cg)->setTargetOptions(Options);
     parsedOptions = true;
   }
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19015.53397.patch
Type: text/x-patch
Size: 396 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160412/4fee345a/attachment.bin>


More information about the llvm-commits mailing list