--
Peter
_______________________________________________
cfe-dev mailing list
cfe...@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
We’ve had some recent improvements that speed things up considerably, and hopefully things will continue to get faster, but I’m sure there will always be cases where LTO is slower.
Option (2) makes more sense to me, but I don’t like the idea of introducing a new command line option. At least for now, this seems like a fairly special-purpose request for CFI. I haven’t heard anyone else asking for LTO with minimal optimization. How about if you just pass the “-mllvm” options yourself when using CFI?
If it turns out that there are lots of people who want this feature, I could imagine that we might someday repurpose the existing -O optimization options to pass something to the linker to control LTO optimization. The downside of that is the clang driver doesn’t know whether the link will involve LTO or not, so it would have to pass those flags to the linker all the time. That’s not a real problem, but it’s just extra complexity that doesn’t seem justified unless it benefits more people.
> Optimization Levels
> -------------------
>
> We need to decide what the various optimization levels mean. The thing that
> works best for the CFI use case is for -flto-level=2 to mean what -flto
> currently means, for -flto-level=1 to mean "run only the globaldce and
> simplifycfg passes", and for -flto-level=0 to mean "run no passes", but this
> may not be the correct thing to do in every situation where we only want a
> few passes to run at link time. We may want to make -flto-level a cc1-level
> flag until we've had more experience and found more use cases.
>
> Thanks,
> --
> Peter
> _______________________________________________
> cfe-dev mailing list
> cfe...@cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Today I found http://reviews.llvm.org/D8431 which seems to fix one of the
big performance issues I was suffering from. Binary size is still an issue
though and I've found opt-level=1 makes a significant improvement there.
I assume you mean a driver command line option.
> At least for now, this seems like a fairly special-purpose request for CFI. I haven’t heard anyone else asking for LTO with minimal optimization. How about if you just pass the “-mllvm” options yourself when using CFI?
That would work, if we had something like a -opt-level flag that the gold and
libLTO plugins understand. (We already have disable-opt on the libLTO side,
but I'd still like a way of saying opt-level=1).
> If it turns out that there are lots of people who want this feature, I could imagine that we might someday repurpose the existing -O optimization options to pass something to the linker to control LTO optimization. The downside of that is the clang driver doesn’t know whether the link will involve LTO or not, so it would have to pass those flags to the linker all the time. That’s not a real problem, but it’s just extra complexity that doesn’t seem justified unless it benefits more people.
Seems reasonable.
Thanks,
--
Peter
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.
Please check and reject things like -OX at least in the gold plugin.
Can you add a test showing that
* createLowerBitSetsPass is run at -O0
* the addLateLTOOptimizationPasses passes are run at -O1, but not -O0
I think the patch is fine otherwise, but wait for a review from
someone on the ld64 side (Duncan, Manman or Bob for example).
Thanks,
Rafael
_______________________________________________
Should this -O level be shared with CodeGen?
> On 2015-Mar-19, at 13:13, Rafael Espíndola <rafael.e...@gmail.com> wrote:
>
> + OptLevel = opt[1] - '0';
>
> Please check and reject things like -OX at least in the gold plugin.
Same with the libLTO API and `llvm-lto`.
It might be nice to write a single utility function to verify this that's
shared between the three consumers?