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

Mehdi AMINI via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 13 00:01:38 PDT 2016


joker.eph added a comment.

In http://reviews.llvm.org/D19015#399459, @thomasguest wrote:

> In http://reviews.llvm.org/D19015#398910, @joker.eph wrote:
>
> > Note: this is an interface intended for *debug*, you're not suppose to use it or rely on it in production: it has no stability guarantee (that I know of).
> >  With this in mind, that seems fine to me.
>
>
> Thanks for the comment @joker.eph
>
> If I'm using the LTO.dll via the interface defined in llvm/include/llvm-c/lto.h, then the only function which allows me full control codegen configuration is lto_codegen_debug_options(). Perhaps the function is misnamed, and should actually be called lto_codegen_set_options().


No, really no...

> The original purpose of this API function is for debugging,  but without the fix I do not think all the options passed in will be used anyway.


The things is: throughout LLVM it is considered that any global cl::opt is here only for development and should not be used to control LLVM by a client. If there is a need to control a cl::opt other than debugging something, then there is a missing API.
For instance you are mentioning `function-sections`, here is how clang initialize it: https://github.com/llvm-mirror/clang/blob/master/lib/CodeGen/BackendUtil.cpp#L573


http://reviews.llvm.org/D19015





More information about the llvm-commits mailing list