Skip to content

Commit

Permalink
check if the LLVM submodule is fetched in is_ci_llvm_modified
Browse files Browse the repository at this point in the history
Signed-off-by: onur-ozkan <work@onurozkan.dev>
  • Loading branch information
onur-ozkan committed Sep 23, 2024
1 parent 90745bd commit 6658c8e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 11 additions & 1 deletion src/bootstrap/src/core/build_steps/llvm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,17 @@ pub(crate) fn is_ci_llvm_available(config: &Config, asserts: bool) -> bool {

/// Returns true if we're running in CI with modified LLVM (and thus can't download it)
pub(crate) fn is_ci_llvm_modified(config: &Config) -> bool {
CiEnv::is_ci() && config.rust_info.is_managed_git_subrepository() && {
// If the LLVM submodule is unavailable (which is the case when `llvm.download-ci-llvm` is set to true),
// LLVM cannot be modified which means it is unnecessary to run the git logic below.
//
// This is very unlikely to happen on our (rust-lang/rust) CI runners, as we intentionally fetch all
// submodules in CI and most of the time (probably always) prefer `llvm.download-ci-llvm` to be set
// to "if-unchanged" or true.
if config.in_tree_llvm_info.is_managed_git_subrepository() {
return false;
}

CiEnv::is_ci() && {
// We assume we have access to git, so it's okay to unconditionally pass
// `true` here.
let llvm_sha = detect_llvm_sha(config, true);
Expand Down
2 changes: 0 additions & 2 deletions src/bootstrap/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,6 @@ impl Build {
let miri_info = config.miri_info.clone();
let rustfmt_info = config.rustfmt_info.clone();
let enzyme_info = config.enzyme_info.clone();

// we always try to use git for LLVM builds
let in_tree_llvm_info = config.in_tree_llvm_info.clone();
let in_tree_gcc_info = config.in_tree_gcc_info.clone();

Expand Down

0 comments on commit 6658c8e

Please sign in to comment.