Skip to content

Commit 666996a

Browse files
Auto merge of #143898 - ognevny:opt-dist-rustc-rebuild, r=<try>
opt-dist: rebuild rustc when doing static LLVM builds when building LLVM it's obvious that in case of shared build rustc doesn't need to be recompiled, but with static builds it would be better to compile rustc again to ensure we linked proper library. maybe I didn't understand the pipeline correctly, but it was strange for me to see that in Stage 5 LLVM is built while rustc is not <!-- homu-ignore:start --> <!-- If this PR is related to an unstable feature or an otherwise tracked effort, please link to the relevant tracking issue here. If you don't know of a related tracking issue or there are none, feel free to ignore this. This PR will get automatically assigned to a reviewer. In case you would like a specific user to review your work, you can assign it to them by using r? <reviewer name> --> <!-- homu-ignore:end --> r? `@Kobzol` try-job: dist-x86_64-msvc try-job: dist-x86_64-linux
2 parents 56835d7 + 32edd53 commit 666996a

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/tools/opt-dist/src/exec.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,12 @@ impl Bootstrap {
185185
self
186186
}
187187

188+
/// In case of statically linked rustc rebuild it to ensure that proper one is linked
189+
pub fn rustc_rebuild(mut self) -> Self {
190+
self.cmd = self.cmd.arg("--keep-stage").arg("0").arg("--keep-stage-std").arg("1");
191+
self
192+
}
193+
188194
pub fn run(self, timer: &mut TimerSection) -> anyhow::Result<()> {
189195
self.cmd.run()?;
190196
let metrics = load_metrics(&self.metrics_path)?;

src/tools/opt-dist/src/main.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,8 +343,10 @@ fn execute_pipeline(
343343

344344
let mut dist = Bootstrap::dist(env, &dist_args)
345345
.llvm_pgo_optimize(&llvm_pgo_profile)
346-
.rustc_pgo_optimize(&rustc_pgo_profile)
347-
.avoid_rustc_rebuild();
346+
.rustc_pgo_optimize(&rustc_pgo_profile);
347+
348+
dist =
349+
if env.supports_shared_llvm() { dist.avoid_rustc_rebuild() } else { dist.rustc_rebuild() };
348350

349351
for bolt_profile in bolt_profiles {
350352
dist = dist.with_bolt_profile(bolt_profile);

0 commit comments

Comments
 (0)