Skip to content

Commit 871407a

Browse files
committed
Auto merge of #115554 - Kobzol:single-cgu, r=Mark-Simulacrum
Build `rustc` with a single CGU on x64 Linux This PR adds the `rust.codegen-units=1` setting when compiling the 64-bit Linux `rustc` artifact (the one used for try builds and Linux rustup distribution). This had mixed results in the past, however after the bump to LLVM 17, the results now seem pretty [incredible](#115554 (comment)). Instruction counts, cycles, wall time, max RSS and even artifact sizes see large improvements. The last [try build](https://github.com/rust-lang-ci/rust/actions/runs/6077686494/job/16487768049) with this setting took 1h 8m, which is basically the same duration for try builds that we have seen recently. So there shouldn't be any large hit to CI/build time. I hope that this could potentially also reduce codegen noise of `rustc` a little bit, since small changes within a single `rustc` crate should no longer perturb optimizations because of CGU movement. We still do cross-crate LTO, so it won't eliminate it though. r? `@Mark-Simulacrum`
2 parents c16823d + ca59652 commit 871407a

File tree

1 file changed

+2
-1
lines changed
  • src/ci/docker/host-x86_64/dist-x86_64-linux

1 file changed

+2
-1
lines changed

src/ci/docker/host-x86_64/dist-x86_64-linux/Dockerfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ ENV RUST_CONFIGURE_ARGS \
8484
--set llvm.ninja=false \
8585
--set rust.jemalloc \
8686
--set rust.use-lld=true \
87-
--set rust.lto=thin
87+
--set rust.lto=thin \
88+
--set rust.codegen-units=1
8889

8990
ENV SCRIPT python3 ../x.py build --set rust.debug=true opt-dist && \
9091
./build/$HOSTS/stage0-tools-bin/opt-dist linux-ci -- python3 ../x.py dist \

0 commit comments

Comments
 (0)