Skip to content

Commit ff227c4

Browse files
committed
rustbuild: Remove ThinLTO-related configuration
This commit removes some ThinLTO/codegen unit cruft primarily only needed during the initial phase where we were adding ThinLTO support to rustc itself. The current bootstrap compiler knows about ThinLTO and has it enabled by default for multi-CGU builds which are also enabled by default. One CGU builds (aka disabling ThinLTO) can be achieved by configuring the number of codegen units to 1 for a particular builds. This also changes the defaults for our dist builders to go back to multiple CGUs. Unfortunately we're seriously bleeding for cycle time on the bots right now so we need to recover any time we can.
1 parent fedce67 commit ff227c4

File tree

5 files changed

+0
-21
lines changed

5 files changed

+0
-21
lines changed

src/bootstrap/bin/rustc.rs

-3
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,6 @@ fn main() {
175175
if let Ok(s) = env::var("RUSTC_CODEGEN_UNITS") {
176176
cmd.arg("-C").arg(format!("codegen-units={}", s));
177177
}
178-
if env::var("RUSTC_THINLTO").is_ok() {
179-
cmd.arg("-Ccodegen-units=16").arg("-Zthinlto");
180-
}
181178

182179
// Emit save-analysis info.
183180
if env::var("RUSTC_SAVE_ANALYSIS") == Ok("api".to_string()) {

src/bootstrap/builder.rs

-11
Original file line numberDiff line numberDiff line change
@@ -792,17 +792,6 @@ impl<'a> Builder<'a> {
792792
if cmd != "bench" {
793793
cargo.arg("--release");
794794
}
795-
796-
if self.config.rust_codegen_units.is_none() &&
797-
self.build.is_rust_llvm(compiler.host) &&
798-
self.config.rust_thinlto {
799-
cargo.env("RUSTC_THINLTO", "1");
800-
} else if self.config.rust_codegen_units.is_none() {
801-
// Generally, if ThinLTO has been disabled for some reason, we
802-
// want to set the codegen units to 1. However, we shouldn't do
803-
// this if the option was specifically set by the user.
804-
cargo.env("RUSTC_CODEGEN_UNITS", "1");
805-
}
806795
}
807796

808797
if self.config.locked_deps {

src/bootstrap/config.rs

-5
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ pub struct Config {
8686
// rust codegen options
8787
pub rust_optimize: bool,
8888
pub rust_codegen_units: Option<u32>,
89-
pub rust_thinlto: bool,
9089
pub rust_debug_assertions: bool,
9190
pub rust_debuginfo: bool,
9291
pub rust_debuginfo_lines: bool,
@@ -269,7 +268,6 @@ impl Default for StringOrBool {
269268
struct Rust {
270269
optimize: Option<bool>,
271270
codegen_units: Option<u32>,
272-
thinlto: Option<bool>,
273271
debug_assertions: Option<bool>,
274272
debuginfo: Option<bool>,
275273
debuginfo_lines: Option<bool>,
@@ -427,7 +425,6 @@ impl Config {
427425

428426
// Store off these values as options because if they're not provided
429427
// we'll infer default values for them later
430-
let mut thinlto = None;
431428
let mut llvm_assertions = None;
432429
let mut debuginfo_lines = None;
433430
let mut debuginfo_only_std = None;
@@ -471,7 +468,6 @@ impl Config {
471468
optimize = rust.optimize;
472469
ignore_git = rust.ignore_git;
473470
debug_jemalloc = rust.debug_jemalloc;
474-
thinlto = rust.thinlto;
475471
set(&mut config.rust_optimize_tests, rust.optimize_tests);
476472
set(&mut config.rust_debuginfo_tests, rust.debuginfo_tests);
477473
set(&mut config.codegen_tests, rust.codegen_tests);
@@ -559,7 +555,6 @@ impl Config {
559555
"stable" | "beta" | "nightly" => true,
560556
_ => false,
561557
};
562-
config.rust_thinlto = thinlto.unwrap_or(true);
563558
config.rust_debuginfo_lines = debuginfo_lines.unwrap_or(default);
564559
config.rust_debuginfo_only_std = debuginfo_only_std.unwrap_or(default);
565560

src/bootstrap/configure.py

-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ def v(*args):
7171
# Optimization and debugging options. These may be overridden by the release
7272
# channel, etc.
7373
o("optimize", "rust.optimize", "build optimized rust code")
74-
o("thinlto", "rust.thinlto", "build Rust with ThinLTO enabled")
7574
o("optimize-llvm", "llvm.optimize", "build optimized LLVM")
7675
o("llvm-assertions", "llvm.assertions", "build LLVM with assertions")
7776
o("debug-assertions", "rust.debug-assertions", "build with debugging assertions")

src/ci/run.sh

-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ export RUST_RELEASE_CHANNEL=nightly
4646
if [ "$DEPLOY$DEPLOY_ALT" != "" ]; then
4747
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --release-channel=$RUST_RELEASE_CHANNEL"
4848
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --enable-llvm-static-stdcpp"
49-
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --disable-thinlto"
5049

5150
if [ "$NO_LLVM_ASSERTIONS" = "1" ]; then
5251
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --disable-llvm-assertions"

0 commit comments

Comments
 (0)