Stream: t-compiler

Topic: whole crate graph LTO?


pnkfelix (Mar 28 2019 at 15:34, on Zulip):

Hey @mw , where can I go to learn more about the whole crate graph LTO that you mentioned in the meeting?

Zoxc (Mar 28 2019 at 15:35, on Zulip):

Isn't that just -C lto=thin? Though C lto=fat would also count I guess

pnkfelix (Mar 28 2019 at 15:36, on Zulip):

i got the impression from @mw that there were two kinds of thin LTO

mw (Mar 28 2019 at 15:38, on Zulip):

So, there is "local" ThinLTO which does ThinLTO just among the object files of the _current_ crate

mw (Mar 28 2019 at 15:38, on Zulip):

and then there is crate graph ThinLTO which (like "fat" LTO) pulls in the LLVM bitcode of upstream crates too

mw (Mar 28 2019 at 15:39, on Zulip):

if you don't specify -C lto and compile with multiple codegen units then local ThinLTO will be used

mw (Mar 28 2019 at 15:40, on Zulip):

if you compile with just one CGU, then local ThinLTO makes no sense, so no ThinLTO is performed at all

mw (Mar 28 2019 at 15:40, on Zulip):

I think -C lto=thin will get you whole-crate-graph ThinLTO

pnkfelix (Mar 28 2019 at 15:41, on Zulip):

I think -C lto=thin will get you whole-crate-graph ThinLTO

ah!

pnkfelix (Mar 28 2019 at 15:42, on Zulip):

so there's no way to explicitly encode the behavior that we get by default?

pnkfelix (Mar 28 2019 at 15:42, on Zulip):

I was doing -C lto=thin thinking that yielded something equivalent to our default when i had multiple codegen units.

pnkfelix (Mar 28 2019 at 15:42, on Zulip):

but it sounds like you are saying that is false?

pnkfelix (Mar 28 2019 at 15:43, on Zulip):

let me go look at my results again

mw (Mar 28 2019 at 15:45, on Zulip):

yes, there is no way to force the default behavior via -C lto

mw (Mar 28 2019 at 15:46, on Zulip):

this is where the decision is made: https://github.com/rust-lang/rust/blob/237bf3244fffef501cf37d4bda00e1fce3fcfb46/src/librustc/session/mod.rs#L558-L625

mw (Mar 28 2019 at 15:46, on Zulip):

-Z thinlto seems to let you force local ThinLTO

Last update: Nov 20 2019 at 02:00UTC