[LLVMdev] [cfe-dev] Controlling the LTO optimization level

Eric Christopher echristo at gmail.com
Thu Mar 19 11:32:56 PDT 2015

On Thu, Mar 19, 2015 at 11:12 AM Rafael EspĂ­ndola <
rafael.espindola at gmail.com> wrote:

> Having the analogous of -O0/-O1/-O2/-O3 for the LTO pipeline makes
> sense I think.
> I agree that something along option number 2 is probably the best.
> Some questions:
> * Should "clang -O3 foo.o -o foo" use LTO with -O3?
> * Should "clang foo.o -o foo" use LTO with -O0? That would be a fairly
> big change. Maybe we could make the LTO default be 3?
> * Should we just add a --ltoO to the clang driver that is independent of
> -O?
> * Some linkers already take a -O(1,2,3) option. Should we try to
> forward that or should we differentiate LTO optimizations and general
> linker optimizations?
The linker taking -O1,2,3 as a start is fine for sure. I'd rather this go
from a clang driving everything perspective than a linker driving
everything, but that ship may have sailed.

> If we want to differentiate linker and LTO optimizations, adding a -O
> plugin option to the gold plugin should be fine. As Bob points out,
> for ld64 for now we would just use -mllvm.

Sure. A better command line interface similar to the one that we already
have in clang to deal with enabling/disabling passes (or, perhaps, one
that's even better - we're not very good at that at the moment) would be
ultimately a good place to be. Otherwise the interface is just going to be
some sort of special case hell for what everyone wants to do at the LTO

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150319/b8a70ba7/attachment.html>

More information about the llvm-dev mailing list