[PATCH] Pass -mglobal-merge as a module flag metadata.

Duncan P. N. Exon Smith dexonsmith at apple.com
Fri Mar 13 16:39:09 PDT 2015


> On 2015-Mar-13, at 16:09, Eric Christopher <echristo at gmail.com> wrote:
> 
> No, you probably haven't. I was seeing it as clang doing to lto link of the module together and then codegen based on that (which means it would have the options), but...
> 
> That said, I think the general problem is more specific. I.e. how do you specify -msse3 as part of the default code generation flags when you do lto?
> 
> The C++ interface has addAttr (which is painful in that it requires, as you say, every linker to understand llvm's command line interface), but this is also pretty painful:
> 
>  const void *compile(size_t *length,
>                      bool disableOpt,
>                      bool disableInline,
>                      bool disableGVNLoadPRE,
>                      bool disableVectorization,
>                      std::string &errMsg);
> 
> because, you know, all optimizations, inlining, gvnloadpre, and vectorization are all anyone care about :)

Those are just debugging options to `llvm-lto` -- they're not exposed
in the LTO API, so the linker doesn't even have access to these.

> 
> Realize this has dovetailed into "let's solve the general problem" but I am curious. The gold plugin's methods aren't much better.
> 
> Or am I missing something?

`sse3` would be in the target options that will be stored in
function attributes for the functions originating in modules
compiled with `-msse3`.  When your subtarget-switching work is
complete, then the right subtarget will be selected during CodeGen.

In this world, do we care about specifying the "default" subtarget?
Why?

> 
> http://reviews.llvm.org/D7968
> 
> EMAIL PREFERENCES
>  http://reviews.llvm.org/settings/panel/emailpreferences/
> 
> 





More information about the cfe-commits mailing list