[cfe-dev] Controlling the LTO optimization level

Rafael EspĂ­ndola rafael.espindola at gmail.com
Thu Mar 19 11:09:58 PDT 2015


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?

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.

Cheers,
Rafael



More information about the cfe-dev mailing list