Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/tools/opt-dist/src/exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,12 @@ impl Bootstrap {
self
}

/// Rebuild rustc in case of statically linked LLVM
pub fn rustc_rebuild(mut self) -> Self {
self.cmd = self.cmd.arg("--keep-stage").arg("0");
self
}

pub fn run(self, timer: &mut TimerSection) -> anyhow::Result<()> {
self.cmd.run()?;
let metrics = load_metrics(&self.metrics_path)?;
Expand Down
10 changes: 8 additions & 2 deletions src/tools/opt-dist/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,14 @@ fn execute_pipeline(

let mut dist = Bootstrap::dist(env, &dist_args)
.llvm_pgo_optimize(llvm_pgo_profile.as_ref())
.rustc_pgo_optimize(&rustc_pgo_profile)
.avoid_rustc_rebuild();
.rustc_pgo_optimize(&rustc_pgo_profile);

// if LLVM is not built we'll have PGO optimized rustc
dist = if env.supports_shared_llvm() || !env.build_llvm() {
dist.avoid_rustc_rebuild()
} else {
dist.rustc_rebuild()
};

for bolt_profile in bolt_profiles {
dist = dist.with_bolt_profile(bolt_profile);
Expand Down
Loading