Assorted bootstrap LLVM refactors (part 1/N) - #160645
Conversation
|
This PR modifies If appropriate, please update This PR changes how LLVM is built. Consider updating src/bootstrap/download-ci-llvm-stamp. |
|
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
(Will take a look later today) |
There was a problem hiding this comment.
Thanks, r=me after a rebase.
@bors rollup=never note="bootstrap llvm refactors"
|
@rustbot author |
At this point in the code, the LLVM config could not have been set by `download-ci-llvm` yet, so we don't have to check it.
To make it consistent with `GccOutput`
So that it can be used explicitly in bootstrap, rather than depending on `builder.llvm_out`.
To remove dependency on implicit paths.
And replace it with an explicit `FileCheck` step
To avoid someone depending on implicit paths. Instead, the step should be executed and the path should be taken from its output.
…-llvm` is enabled Note: this commit removed reading `FileCheck` from `<artifact-dir>/build/<profile>/bin`, and instead reads it from `<artifact-dir>/bin` directly. It should still work with MSVC and without Ninja.
|
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. |
|
@bors r=jieyouxu |
|
⌛ Testing commit 7a1d067 with merge ef20314... Workflow: https://github.com/rust-lang/rust/actions/runs/31404991484 |
Assorted bootstrap LLVM refactors (part 1/N) This PR continues my LLVM and `download-ci-llvm` bootstrap refactors (it took me almost a year to get back to them, lol), with the goals of: - Remove dependency on implicit paths with artifacts. Ideally, everything should only depend on output paths from executed steps. - Reduce eager and implicit downloads and other shenanigans happening in config parsing, particularly around `download-ci-llvm`. - Allow downloading LLVM from CI for non-host targets. There is not really any reason why bootstrap shouldn't be able to download LLVM from CI if it's there for any given target, but right now it can only do so for the host target. This would be useful for debugging bootstrap itself, and perhaps for some people also for development. - Centralize the handling of LLVM into the `Llvm` step, and reduce overall knowledge between locally built and downloaded LLVM. Ideally, most of bootstrap shouldn't know about whether it uses a LLVM that was built locally or downloaded. But that is of course not the case today, because there are many places in bootstrap that ad-hoc work with some LLVM paths, and do things that depend on some part of bootstrap randomly modifying a config here or there, or doing some side effect, which then makes the other activity "work". But of course, this is very fragile, as we know. - If I manage to reach the previous goal, this should massively help unblock further unborking of `download-ci-rustc`. Those two features are quite interrelated, and sadly both are scattered across the codebase. I actually first wanted to start with refactoring `download-ci-rustc`, but I couldn't find a way to do that without first improving `download-ci-llvm`. This PR contains a bunch of commits that slowly move us towards these goals. The refactors were quite explanatory, they are mostly a preparation for larger refactors that I had in mind, so nothing major. But as always, step by step. As usually, best reviewed commit-by-commit. Some notes for review: - The last commit might case a behavior change (well, or an error) on MSVC without Ninja, when filecheck is used without `download-ci-llvm`. As per the [experiment on Zulip](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Building.20LLVM.20on.20Windows/near/615072154), this should be fine. And I'm not sure if anyone actually uses MSVC without Ninja in bootstrap, it seems to be quite broken. - 07b88f2 removes a sanity check for FileCheck being present. It was a bit hacky, because it was only checking it if it wasn't locally built (or downloaded from CI...). To avoid introducing more hacks, I just removed this sanity check. If the code will need filecheck and it won't be available, it will error out at the usage site (or I could add an assert that the FileCheck binary is present in the `FileCheck` step if you want). r? jieyouxu
This PR continues my LLVM and
download-ci-llvmbootstrap refactors (it took me almost a year to get back to them, lol), with the goals of:download-ci-llvm.Llvmstep, and reduce overall knowledge between locally built and downloaded LLVM. Ideally, most of bootstrap shouldn't know about whether it uses a LLVM that was built locally or downloaded. But that is of course not the case today, because there are many places in bootstrap that ad-hoc work with some LLVM paths, and do things that depend on some part of bootstrap randomly modifying a config here or there, or doing some side effect, which then makes the other activity "work". But of course, this is very fragile, as we know.download-ci-rustc. Those two features are quite interrelated, and sadly both are scattered across the codebase. I actually first wanted to start with refactoringdownload-ci-rustc, but I couldn't find a way to do that without first improvingdownload-ci-llvm.This PR contains a bunch of commits that slowly move us towards these goals. The refactors were quite explanatory, they are mostly a preparation for larger refactors that I had in mind, so nothing major. But as always, step by step.
As usually, best reviewed commit-by-commit.
Some notes for review:
download-ci-llvm. As per the experiment on Zulip, this should be fine. And I'm not sure if anyone actually uses MSVC without Ninja in bootstrap, it seems to be quite broken.FileCheckstep if you want).r? jieyouxu