[PATCH] D15641: [Driver] Pass -O* to the gold plugin via -plugin-opt

Mehdi Amini via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 18 15:17:10 PST 2015



Sent from my iPhone

> On Dec 18, 2015, at 4:06 AM, Rafael Ávila de Espíndola <rafael.espindola at gmail.com> wrote:
> 
> rafael added a subscriber: rafael.
> rafael added a comment.
> 
> This introduces a meaning to -ON during the link. That normally show up by people passing CFLAGS when linking.

I'm not sure what you mean? When I build clang with cake the link is driven by clang, it will accept the O flag by not propagate it to the actual linker. How would CFLAGS help?

Now we thought about that a few months ago and we were planning to do something during the bring up of ThinLTO. 
The alternative to the command line flag is to encode the optimization level in the bitcode itself.
It may have the advantage (for ThinLTO) to be able to LTO each file with different optimization level.

-- 
Mehdi



> 
> I think that is OK, but would like a second opinion.
> 
> 
> ================
> Comment at: lib/Driver/Tools.cpp:1815
> @@ +1814,3 @@
> +    } else if (A->getOption().matches(options::OPT_O0)) {
> +      CmdArgs.push_back("-plugin-opt=O0");
> +    } else {
> ----------------
> Can you refactor these 3 calls to push_back?
> 
> ================
> Comment at: lib/Driver/Tools.cpp:1817
> @@ +1816,3 @@
> +    } else {
> +      ToolChain.getDriver().Diag(clang::diag::warn_drv_unused_argument)
> +          << A->getAsString(Args);
> ----------------
> Why do you need to manually issue a diagnostic?
> 
> 
> 
> Repository:
>  rL LLVM
> 
> http://reviews.llvm.org/D15641
> 
> 
> 


More information about the cfe-commits mailing list