Skip to content

Commit c4771ec

Browse files
committed
[beta] Turn back on "fat" LTO by default
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 #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 #47409
1 parent 597549e commit c4771ec

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/librustc/session/mod.rs

+9-3
Original file line numberDiff line numberDiff line change
@@ -807,9 +807,15 @@ impl Session {
807807
return enabled
808808
}
809809

810-
// If there's only one codegen unit and LTO isn't enabled then there's
811-
// no need for ThinLTO so just return false.
812-
if self.codegen_units() == 1 && !self.lto() {
810+
// If LTO is enabled we right now unconditionally disable ThinLTO.
811+
// This'll come at a later date! (full crate graph ThinLTO)
812+
if self.lto() {
813+
return false
814+
}
815+
816+
// If there's only one codegen unit or then there's no need for ThinLTO
817+
// so just return false.
818+
if self.codegen_units() == 1 {
813819
return false
814820
}
815821

0 commit comments

Comments
 (0)