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
8
8
9
9
codegen_ssa_archive_build_failure = failed to build archive at `{ $path } `: { $error }
10
10
11
- codegen_ssa_autodiff_without_lto = using the autodiff feature requires using fat-lto
12
-
13
11
codegen_ssa_bare_instruction_set = `#[instruction_set]` requires an argument
14
12
15
13
codegen_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> {
37
37
pub cgu_name : & ' a str ,
38
38
}
39
39
40
- #[ derive( Diagnostic ) ]
41
- #[ diag( codegen_ssa_autodiff_without_lto) ]
42
- pub struct AutodiffWithoutLto ;
43
-
44
40
#[ derive( Diagnostic ) ]
45
41
#[ diag( codegen_ssa_unknown_reuse_kind) ]
46
42
pub ( crate ) struct UnknownReuseKind {
Original file line number Diff line number Diff line change @@ -1509,6 +1509,11 @@ impl Options {
1509
1509
pub fn get_symbol_mangling_version ( & self ) -> SymbolManglingVersion {
1510
1510
self . cg . symbol_mangling_version . unwrap_or ( SymbolManglingVersion :: Legacy )
1511
1511
}
1512
+
1513
+ #[ inline]
1514
+ pub fn autodiff_enabled ( & self ) -> bool {
1515
+ self . unstable_opts . autodiff . contains ( & AutoDiff :: Enable )
1516
+ }
1512
1517
}
1513
1518
1514
1519
impl UnstableOptions {
Original file line number Diff line number Diff line change @@ -600,6 +600,13 @@ impl Session {
600
600
601
601
/// Calculates the flavor of LTO to use for this compilation.
602
602
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
+
603
610
// If our target has codegen requirements ignore the command line
604
611
if self . target . requires_lto {
605
612
return config:: Lto :: Fat ;
You can’t perform that action at this time.
0 commit comments