Skip to content

Commit f5210f2

Browse files
Rollup merge of #143898 - ognevny:opt-dist-rustc-rebuild, r=Kobzol
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 r? ```@Kobzol``` try-job: dist-x86_64-msvc try-job: dist-x86_64-linux
2 parents c5a6a7b + 6e00231 commit f5210f2

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,12 @@ impl Bootstrap {
189189
self
190190
}
191191

192+
/// Rebuild rustc in case of statically linked LLVM
193+
pub fn rustc_rebuild(mut self) -> Self {
194+
self.cmd = self.cmd.arg("--keep-stage").arg("0");
195+
self
196+
}
197+
192198
pub fn run(self, timer: &mut TimerSection) -> anyhow::Result<()> {
193199
self.cmd.run()?;
194200
let metrics = load_metrics(&self.metrics_path)?;

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,8 +375,14 @@ fn execute_pipeline(
375375

376376
let mut dist = Bootstrap::dist(env, &dist_args)
377377
.llvm_pgo_optimize(llvm_pgo_profile.as_ref())
378-
.rustc_pgo_optimize(&rustc_pgo_profile)
379-
.avoid_rustc_rebuild();
378+
.rustc_pgo_optimize(&rustc_pgo_profile);
379+
380+
// if LLVM is not built we'll have PGO optimized rustc
381+
dist = if env.supports_shared_llvm() || !env.build_llvm() {
382+
dist.avoid_rustc_rebuild()
383+
} else {
384+
dist.rustc_rebuild()
385+
};
380386

381387
for bolt_profile in bolt_profiles {
382388
dist = dist.with_bolt_profile(bolt_profile);

0 commit comments

Comments
 (0)