summary refs log tree commit diff
path: root/src/rt/rust_kernel.cpp
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2020-06-08 09:02:57 -0700
committerMark Rousskov <mark.simulacrum@gmail.com>2020-07-10 10:54:21 -0400
commit25ac6de3b093e2812f15d9cde00975a0b050ee19 (patch)
treec532d54da96ee827c2f97c7bddf576914be75bba /src/rt/rust_kernel.cpp
parentffebd8ac8aa290cff345a407a734c5fdf0785fdb (diff)
downloadrust-25ac6de3b093e2812f15d9cde00975a0b050ee19.tar.gz
rust-25ac6de3b093e2812f15d9cde00975a0b050ee19.zip
Change how compiler-builtins gets many CGUs
This commit intends to fix an accidental regression from #70846. The
goal of #70846 was to build compiler-builtins with a maximal number of
CGUs to ensure that each module in the source corresponds to an object
file. This high degree of control for compiler-builtins is desirable to
ensure that there's at most one exported symbol per CGU, ideally
enabling compiler-builtins to not conflict with the system libgcc as
often.

In #70846, however, only part of the compiler understands that
compiler-builtins is built with many CGUs. The rest of the compiler
thinks it's building with `sess.codegen_units()`. Notably the
calculation of `sess.lto()` consults `sess.codegen_units()`, which when
there's only one CGU it disables ThinLTO. This means that
compiler-builtins is built without ThinLTO, which is quite harmful to
performance! This is the root of the cause from #73135 where intrinsics
were found to not be inlining trivial functions.

The fix applied in this commit is to remove the special-casing of
compiler-builtins in the compiler. Instead the build system is now
responsible for special-casing compiler-builtins. It doesn't know
exactly how many CGUs will be needed but it passes a large number that
is assumed to be much greater than the number of source-level modules
needed. After reading the various locations in the compiler source, this
seemed like the best solution rather than adding more and more special
casing in the compiler for compiler-builtins.

Closes #73135
Diffstat (limited to 'src/rt/rust_kernel.cpp')
0 files changed, 0 insertions, 0 deletions