File tree Expand file tree Collapse file tree 4 files changed +12
-6
lines changed Expand file tree Collapse file tree 4 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -8,8 +8,6 @@ codegen_ssa_aix_strip_not_used = using host's `strip` binary to cross-compile to
88
99codegen_ssa_archive_build_failure = failed to build archive at `{ $path } `: { $error }
1010
11- codegen_ssa_autodiff_without_lto = using the autodiff feature requires using fat-lto
12-
1311codegen_ssa_bare_instruction_set = `#[instruction_set]` requires an argument
1412
1513codegen_ssa_binary_output_to_tty = option `-o` or `--emit` is used to write binary output type `{ $shorthand } ` to stdout, but stdout is a tty
Original file line number Diff line number Diff line change @@ -37,10 +37,6 @@ pub(crate) struct CguNotRecorded<'a> {
3737 pub cgu_name : & ' a str ,
3838}
3939
40- #[ derive( Diagnostic ) ]
41- #[ diag( codegen_ssa_autodiff_without_lto) ]
42- pub struct AutodiffWithoutLto ;
43-
4440#[ derive( Diagnostic ) ]
4541#[ diag( codegen_ssa_unknown_reuse_kind) ]
4642pub ( crate ) struct UnknownReuseKind {
Original file line number Diff line number Diff line change @@ -1509,6 +1509,11 @@ impl Options {
15091509 pub fn get_symbol_mangling_version ( & self ) -> SymbolManglingVersion {
15101510 self . cg . symbol_mangling_version . unwrap_or ( SymbolManglingVersion :: Legacy )
15111511 }
1512+
1513+ #[ inline]
1514+ pub fn autodiff_enabled ( & self ) -> bool {
1515+ self . unstable_opts . autodiff . contains ( & AutoDiff :: Enable )
1516+ }
15121517}
15131518
15141519impl UnstableOptions {
Original file line number Diff line number Diff line change @@ -600,6 +600,13 @@ impl Session {
600600
601601 /// Calculates the flavor of LTO to use for this compilation.
602602 pub fn lto ( & self ) -> config:: Lto {
603+ // Autodiff currently requires fat-lto to have access to the llvm-ir of all (indirectly) used functions and types.
604+ // fat-lto is the easiest solution to this requirement, but quite expensive.
605+ // FIXME(autodiff): Make autodiff also work with embed-bc instead of fat-lto.
606+ if self . opts . autodiff_enabled ( ) {
607+ return config:: Lto :: Fat ;
608+ }
609+
603610 // If our target has codegen requirements ignore the command line
604611 if self . target . requires_lto {
605612 return config:: Lto :: Fat ;
You can’t perform that action at this time.
0 commit comments