Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bootstrap: Memoize the LLVM rebuild hash to avoid very slow x check #118352

Merged
merged 1 commit into from
Nov 27, 2023
Merged
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
14 changes: 9 additions & 5 deletions src/bootstrap/src/core/build_steps/llvm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use std::fs::{self, File};
use std::io;
use std::path::{Path, PathBuf};
use std::process::Command;
use std::sync::OnceLock;

use crate::core::builder::{Builder, RunConfig, ShouldRun, Step};
use crate::core::config::{Config, TargetSelection};
Expand Down Expand Up @@ -105,13 +106,16 @@ pub fn prebuilt_llvm_config(
let llvm_cmake_dir = out_dir.join("lib/cmake/llvm");
let res = LlvmResult { llvm_config: build_llvm_config, llvm_cmake_dir };

let smart_stamp_hash = generate_smart_stamp_hash(
&builder.config.src.join("src/llvm-project"),
&builder.in_tree_llvm_info.sha().unwrap_or_default(),
);
static STAMP_HASH_MEMO: OnceLock<String> = OnceLock::new();
let smart_stamp_hash = STAMP_HASH_MEMO.get_or_init(|| {
generate_smart_stamp_hash(
&builder.config.src.join("src/llvm-project"),
&builder.in_tree_llvm_info.sha().unwrap_or_default(),
)
});

let stamp = out_dir.join("llvm-finished-building");
let stamp = HashStamp::new(stamp, Some(&smart_stamp_hash));
let stamp = HashStamp::new(stamp, Some(smart_stamp_hash));

if stamp.is_done() {
if stamp.hash.is_none() {
Expand Down
Loading