Skip to content

Commit 1d24e80

Browse files
Hayden602cdzhd
authored andcommitted
When compiling with the flag RUSTFLAGS="-Zautodiff=Enable", lto = "fat" is automatically set.
1 parent 05abce5 commit 1d24e80

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

compiler/rustc_session/src/config.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1507,6 +1507,11 @@ impl Options {
15071507
pub fn get_symbol_mangling_version(&self) -> SymbolManglingVersion {
15081508
self.cg.symbol_mangling_version.unwrap_or(SymbolManglingVersion::Legacy)
15091509
}
1510+
1511+
#[inline]
1512+
pub fn autodiff_enabled(&self) -> bool {
1513+
self.unstable_opts.autodiff.contains(&AutoDiff::Enable)
1514+
}
15101515
}
15111516

15121517
impl UnstableOptions {

compiler/rustc_session/src/session.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -658,6 +658,11 @@ impl Session {
658658

659659
/// Calculates the flavor of LTO to use for this compilation.
660660
pub fn lto(&self) -> config::Lto {
661+
// if autodiff is enabled, use fat lto
662+
if self.opts.autodiff_enabled() {
663+
return config::Lto::Fat;
664+
}
665+
661666
// If our target has codegen requirements ignore the command line
662667
if self.target.requires_lto {
663668
return config::Lto::Fat;

0 commit comments

Comments
 (0)