From 9a26863acc2a8fdd6a21834fa418673ee33861e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Wed, 9 Apr 2025 17:47:32 +0200 Subject: [PATCH] Apply LTO when building rustc tools --- src/bootstrap/src/core/build_steps/tool.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/bootstrap/src/core/build_steps/tool.rs b/src/bootstrap/src/core/build_steps/tool.rs index b58d279359e30..fc8d9d6d57b61 100644 --- a/src/bootstrap/src/core/build_steps/tool.rs +++ b/src/bootstrap/src/core/build_steps/tool.rs @@ -148,7 +148,9 @@ impl Step for ToolBuild { &self.extra_features, ); - if path.ends_with("/rustdoc") && + // Rustc tools (miri, clippy, cargo, rustfmt, rust-analyzer) + // could use the additional optimizations. + if self.mode == Mode::ToolRustc && // rustdoc is performance sensitive, so apply LTO to it. is_lto_stage(&self.compiler) {