Skip to content

Assorted bootstrap LLVM refactors (part 2/N) - #160916

Merged
rust-bors[bot] merged 22 commits into
rust-lang:mainfrom
Kobzol:bootstrap-llvm-2
Aug 16, 2026
Merged

Assorted bootstrap LLVM refactors (part 2/N)#160916
rust-bors[bot] merged 22 commits into
rust-lang:mainfrom
Kobzol:bootstrap-llvm-2

Conversation

@Kobzol

@Kobzol Kobzol commented Aug 11, 2026

Copy link
Copy Markdown
Member

Continuation of #160645.

This PR removes dependence on implicit LLVM CI paths, and generally tries to make depending on various LLVM things more explicit wherever possible. One nice outcome of that is that we no longer override the LLVM config during config parsing when using download-ci-llvm 🎉 We also no longer dynamically download LLVM from CI when someone asks what is the LLVM linkage mode, lol (well, we still need to do it in a few places, but now at least it is explicit).

I tried to ensure that x check compiler does not build or even checkout the LLVM submodule. That being said, there might be some cases where calling get_llvm_build_status might now checkout the LLVM submodule (but it shouldn't happen for x test mir-opt --bless, which was fixed in #130918 - that PR introduced a boolean flag, but it was difficult to understand where it should be set to false/true).

The next thing after this is to try getting rid of the llvm_out function, though that will be probably quite painful. And also explicitly depending on the output of LlvmFromCi, rather than reading llvm_ci_mode.

I printed some step traces using commands like this:

BOOTSTRAP_TRACING=STEP=trace BOOTSTRAP_TRACING_SKIP_TIME=1 ./x build compiler 2> post-cg_default-build-compiler.txt

with this PR and on main.

The BOOTSTRAP_TRACING_SKIP_TIME thing was added in the first commit to make it easier to compare step traces. But later I realized that we should also normalize source code locations of the steps, otherwise if you modify something in a given file with the step, its location will change and it will perturb the diff. Anyway, I can drop the first commit if you want.

Best reviewed commit-by-commit (in fact I don't think it can be really reviewed in another way, lol).

r? jieyouxu

@rustbot

rustbot commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

This PR changes how LLVM is built. Consider updating src/bootstrap/download-ci-llvm-stamp.

This PR modifies src/bootstrap/src/core/config.

If appropriate, please update CONFIG_CHANGE_HISTORY in src/bootstrap/src/utils/change_tracker.rs.

@rustbot rustbot added the A-testsuite Area: The testsuite used to check the correctness of rustc label Aug 11, 2026
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Aug 11, 2026
@rust-log-analyzer

This comment has been minimized.

@rust-bors

This comment has been minimized.

Kobzol added 19 commits August 12, 2026 21:36
To make it easier to compare tracing step outputs.
This allows explicitly depending on LLVM from CI in other parts of bootstrap.
So that the function can run steps.
To avoid implicitly depending on the directory where LLVM CI is extracted.
So that we can later introduce `prebuilt_llvm_config` again, which will never try to checkout the LLVM submodule.
… available

Without checking the LLVM submodule.
The `llvm_out_behaviour` test wasn't very useful. It was just depending on LLVM being downloaded from CI, even if it wasn't really.
@rustbot

rustbot commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@jieyouxu jieyouxu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me overall, just a few nits
@rustbot author

View changes since this review

Comment thread src/bootstrap/src/utils/tracing.rs Outdated
Comment thread src/bootstrap/src/utils/tracing.rs Outdated
// FIXME: llvm_ci_mode should eventually represent what was used in the config, not the
// dynamic value used for determining whether it is actually available.
let llvm_ci_mode =
if llvm_from_ci { LlvmCiMode::DownloadFromCi } else { LlvmCiMode::BuildLocally };

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remark: hm, right, there's two concerns here:

  1. What LLVM CI mode was requested via config
  2. Whether CI LLVM is actually elligble wrt. the config

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah there are even more of those :D

  • What did you request?
  • Is it compatible with your config?
  • Is LLVM CI available for your target?
  • Is LLVM CI available for your value of assertions?
  • Is the LLVM target the host target? (if not, download-ci-llvm doesn't do anything right now)
  • Was it actually possible to download it from the servers?
  • If you have if-unchanged, do you have local modifications?

Comment thread src/bootstrap/src/core/build_steps/llvm.rs Outdated
Comment thread src/bootstrap/src/core/download.rs Outdated
@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 15, 2026
Comment thread src/bootstrap/src/core/build_steps/llvm.rs
@rustbot

rustbot commented Aug 15, 2026

Copy link
Copy Markdown
Collaborator

rustc-dev-guide is developed in its own repository. If possible, consider making this change to rust-lang/rustc-dev-guide instead.

cc @BoxyUwU, @tshepang

@Kobzol

Kobzol commented Aug 15, 2026

Copy link
Copy Markdown
Member Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 15, 2026

@jieyouxu jieyouxu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks
@bors r+ rollup=never note="CI LLVM refactors"

View changes since this review

@rust-bors

rust-bors Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

📌 Commit a0b57de has been approved by jieyouxu

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 16, 2026
@rust-bors

This comment has been minimized.

@rust-bors rust-bors Bot added merged-by-bors This PR was explicitly merged by bors. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Aug 16, 2026
@rust-bors

rust-bors Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

☀️ Test successful - CI
Approved by: jieyouxu
Duration: 3h 7m 17s
Pushing bf063f1 to main...

@rust-bors
rust-bors Bot merged commit bf063f1 into rust-lang:main Aug 16, 2026
14 checks passed
@rustbot rustbot added this to the 1.100.0 milestone Aug 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-testsuite Area: The testsuite used to check the correctness of rustc merged-by-bors This PR was explicitly merged by bors. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants