You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thin local LTO is enabled for dependency crates despite setting lto = "off" (as long as the opt-level is non-zero and codegen-units is greater than 1, as usual). For example, it's enabled for dependencies in both the release and dev profiles with this configuration:
It seems like lto = "off" should apply to dependencies, the same way opt-level applies to dependencies. The other lto settings (regular fat and thin LTO) should continue to not apply to dependencies, as by design, they only apply to the main crate.
Note that changing this would have some impact on #3244.
To reproduce, place the above profiles in the Cargo.toml of a project that has dependencies, and build with RUSTFLAGS="-Z time-passes" cargo +nightly build -j1. Look for the presence of LLVM_lto_optimize passes in the output when building dependencies.
It may also make sense to support disabling thin local LTO in a package profile:
[profile.release.package.foo]
lto = "off"
But this is currently disallowed, giving the error:
`lto` may not be specified in a `package` profile
cargo 1.49.0 (d00d64df9 2020-12-05)
The text was updated successfully, but these errors were encountered:
Propagate `lto=off` harder
This commit fixes an issue with LTO calculation for various units when
`lto=off` is specified in the profile. This ensures now that `lto=off`
is passed to all transitive dependencies as well to disable thin-local
LTO. As an added bonus this also passed `embed-bitcode=no` whenever
`lto=off` is specified since we know we won't be using bitcode anyway.
Closes#9171
Thin local LTO is enabled for dependency crates despite setting
lto = "off"
(as long as theopt-level
is non-zero andcodegen-units
is greater than 1, as usual). For example, it's enabled for dependencies in both the release and dev profiles with this configuration:It seems like
lto = "off"
should apply to dependencies, the same wayopt-level
applies to dependencies. The otherlto
settings (regular fat and thin LTO) should continue to not apply to dependencies, as by design, they only apply to the main crate.Note that changing this would have some impact on #3244.
To reproduce, place the above profiles in the
Cargo.toml
of a project that has dependencies, and build withRUSTFLAGS="-Z time-passes" cargo +nightly build -j1
. Look for the presence ofLLVM_lto_optimize
passes in the output when building dependencies.It may also make sense to support disabling thin local LTO in a package profile:
But this is currently disallowed, giving the error:
cargo 1.49.0 (d00d64df9 2020-12-05)
The text was updated successfully, but these errors were encountered: