Skip to content

Commit

Permalink
[beta] Turn back on "fat" LTO by default
Browse files Browse the repository at this point in the history
This commit reverts a small portion of the switch to ThinLTO by default which
changed the meaning of `-C lto` from "put the whole crate graph into one codegen
unit" to "perform ThinLTO over the whole crate graph". This backport has no
corresponding commit on master as rust-lang#47521 is making the same change but in a
slightly different manner. This commit is intended to be a surgical change with
low impact on beta.

Closes rust-lang#47409
  • Loading branch information
alexcrichton committed Jan 18, 2018
1 parent 597549e commit c4771ec
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/librustc/session/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -807,9 +807,15 @@ impl Session {
return enabled
}

// If there's only one codegen unit and LTO isn't enabled then there's
// no need for ThinLTO so just return false.
if self.codegen_units() == 1 && !self.lto() {
// If LTO is enabled we right now unconditionally disable ThinLTO.
// This'll come at a later date! (full crate graph ThinLTO)
if self.lto() {
return false
}

// If there's only one codegen unit or then there's no need for ThinLTO
// so just return false.
if self.codegen_units() == 1 {
return false
}

Expand Down

0 comments on commit c4771ec

Please sign in to comment.