Skip to content

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

Open
Kobzol wants to merge 19 commits into
rust-lang:mainfrom
Kobzol:bootstrap-llvm-2
Open

Assorted bootstrap LLVM refactors (part 2/N)#160916
Kobzol wants to merge 19 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.

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 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)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants