Skip to content

Commit

Permalink
Auto merge of #47834 - Mark-Simulacrum:no-cgu-release, r=<try>
Browse files Browse the repository at this point in the history
Do not enable ThinLTO on stable, beta, or nightly builds.

Developers testing locally (-dev profile) may want faster builds
for slightly slower compilers (~5%) whereas dist builds should always be
as fast as we can make them, and since those run on CI we don't care
quite as much for the build being somewhat slower. As such, we don't
automatically enable ThinLTO on builds for the stable, beta, or nightly
channels.

Fixes #45444
  • Loading branch information
bors committed Feb 2, 2018
2 parents 616b66d + bbb9860 commit d2192a1
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions config.toml.example
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,11 @@
# compiler.
#codegen-units = 1

# Whether to enable ThinLTO (and increase the codegen units to either a default
# or the configured value). On by default. If we want the fastest possible
# compiler, we should disable this.
#thinlto = true

# Whether or not debug assertions are enabled for the compiler and standard
# library. Also enables compilation of debug! and trace! logging macros.
#debug-assertions = false
Expand Down
4 changes: 2 additions & 2 deletions src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -686,8 +686,8 @@ impl<'a> Builder<'a> {
}

if self.config.rust_codegen_units.is_none() &&
self.build.is_rust_llvm(compiler.host)
{
self.build.is_rust_llvm(compiler.host) &&
self.config.enable_thinlto {
cargo.env("RUSTC_THINLTO", "1");
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/bootstrap/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ pub struct Config {
// rust codegen options
pub rust_optimize: bool,
pub rust_codegen_units: Option<u32>,
pub rust_thinlto: bool,
pub rust_debug_assertions: bool,
pub rust_debuginfo: bool,
pub rust_debuginfo_lines: bool,
Expand Down Expand Up @@ -466,6 +467,7 @@ impl Config {
set(&mut config.quiet_tests, rust.quiet_tests);
set(&mut config.test_miri, rust.test_miri);
set(&mut config.wasm_syscall, rust.wasm_syscall);
config.rust_thinlto = rust_thinlto.unwrap_or(true);
config.rustc_parallel_queries = rust.experimental_parallel_queries.unwrap_or(false);
config.rustc_default_linker = rust.default_linker.clone();
config.musl_root = rust.musl_root.clone().map(PathBuf::from);
Expand Down
1 change: 1 addition & 0 deletions src/bootstrap/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def v(*args):
# Optimization and debugging options. These may be overridden by the release
# channel, etc.
o("optimize", "rust.optimize", "build optimized rust code")
o("thinlto", "rust.thinlto", "build Rust with ThinLTO enabled")
o("optimize-llvm", "llvm.optimize", "build optimized LLVM")
o("llvm-assertions", "llvm.assertions", "build LLVM with assertions")
o("debug-assertions", "rust.debug-assertions", "build with debugging assertions")
Expand Down
1 change: 1 addition & 0 deletions src/ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export RUST_RELEASE_CHANNEL=nightly
if [ "$DEPLOY$DEPLOY_ALT" != "" ]; then
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --release-channel=$RUST_RELEASE_CHANNEL"
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --enable-llvm-static-stdcpp"
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --disable-thinlto"

if [ "$NO_LLVM_ASSERTIONS" = "1" ]; then
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --disable-llvm-assertions"
Expand Down

0 comments on commit d2192a1

Please sign in to comment.