Skip to content

Commit 6658c8e

Browse files
committed
check if the LLVM submodule is fetched in is_ci_llvm_modified
Signed-off-by: onur-ozkan <[email protected]>
1 parent 90745bd commit 6658c8e

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/bootstrap/src/core/build_steps/llvm.rs

+11-1
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,17 @@ pub(crate) fn is_ci_llvm_available(config: &Config, asserts: bool) -> bool {
241241

242242
/// Returns true if we're running in CI with modified LLVM (and thus can't download it)
243243
pub(crate) fn is_ci_llvm_modified(config: &Config) -> bool {
244-
CiEnv::is_ci() && config.rust_info.is_managed_git_subrepository() && {
244+
// If the LLVM submodule is unavailable (which is the case when `llvm.download-ci-llvm` is set to true),
245+
// LLVM cannot be modified which means it is unnecessary to run the git logic below.
246+
//
247+
// This is very unlikely to happen on our (rust-lang/rust) CI runners, as we intentionally fetch all
248+
// submodules in CI and most of the time (probably always) prefer `llvm.download-ci-llvm` to be set
249+
// to "if-unchanged" or true.
250+
if config.in_tree_llvm_info.is_managed_git_subrepository() {
251+
return false;
252+
}
253+
254+
CiEnv::is_ci() && {
245255
// We assume we have access to git, so it's okay to unconditionally pass
246256
// `true` here.
247257
let llvm_sha = detect_llvm_sha(config, true);

src/bootstrap/src/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,6 @@ impl Build {
312312
let miri_info = config.miri_info.clone();
313313
let rustfmt_info = config.rustfmt_info.clone();
314314
let enzyme_info = config.enzyme_info.clone();
315-
316-
// we always try to use git for LLVM builds
317315
let in_tree_llvm_info = config.in_tree_llvm_info.clone();
318316
let in_tree_gcc_info = config.in_tree_gcc_info.clone();
319317

0 commit comments

Comments
 (0)