Skip to content

Commit 9c5e6d0

Browse files
Auto merge of #143898 - ognevny:opt-dist-rustc-rebuild, r=<try>
opt-dist: rebuild rustc when doing static LLVM builds try-job: dist-x86_64-msvc try-job: dist-x86_64-linux
2 parents cd43430 + 6e00231 commit 9c5e6d0

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)