Fix autodiff incorrectly applying fat-lto to proc-macro crates
When -Z autodiff=Enable is used, the compiler automatically enables fat-lto for all crates. However, proc-macro crates cannot use fat-lto without the -Zdylib-lto flag, causing compilation errors. This commit modifies the lto() method in Session to exclude proc-macro crates from fat-lto when autodiff is enabled, while preserving the existing behavior for all other crate types. The fix ensures that: - Non-proc-macro crates still get fat-lto when autodiff is enabled - Proc-macro crates are excluded from fat-lto when autodiff is enabled - Existing autodiff functionality remains unchanged for regular crates Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>
This commit is contained in:
parent
779e19d8ba
commit
e67d502d4e
1 changed files with 2 additions and 1 deletions
|
|
@ -603,7 +603,8 @@ impl Session {
|
|||
// Autodiff currently requires fat-lto to have access to the llvm-ir of all (indirectly) used functions and types.
|
||||
// fat-lto is the easiest solution to this requirement, but quite expensive.
|
||||
// FIXME(autodiff): Make autodiff also work with embed-bc instead of fat-lto.
|
||||
if self.opts.autodiff_enabled() {
|
||||
// Don't apply fat-lto to proc-macro crates as they cannot use fat-lto without -Zdylib-lto
|
||||
if self.opts.autodiff_enabled() && !self.opts.crate_types.contains(&CrateType::ProcMacro) {
|
||||
return config::Lto::Fat;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue