Skip to content

Commit 81b2d55

Browse files
committed
addressing feedback, removing unused arg
1 parent 47c07ed commit 81b2d55

File tree

1 file changed

+5
-20
lines changed

1 file changed

+5
-20
lines changed

Diff for: compiler/rustc_builtin_macros/src/autodiff.rs

+5-20
Original file line numberDiff line numberDiff line change
@@ -233,20 +233,8 @@ mod llvm_enzyme {
233233
.filter(|a| **a == DiffActivity::Active || **a == DiffActivity::ActiveOnly)
234234
.count() as u32;
235235
let (d_sig, new_args, idents, errored) = gen_enzyme_decl(ecx, &sig, &x, span);
236-
let new_decl_span = d_sig.span;
237236
let d_body = gen_enzyme_body(
238-
ecx,
239-
&x,
240-
n_active,
241-
&sig,
242-
&d_sig,
243-
primal,
244-
&new_args,
245-
span,
246-
sig_span,
247-
new_decl_span,
248-
idents,
249-
errored,
237+
ecx, &x, n_active, &sig, &d_sig, primal, &new_args, span, sig_span, idents, errored,
250238
);
251239
let d_ident = first_ident(&meta_item_vec[0]);
252240

@@ -440,12 +428,10 @@ mod llvm_enzyme {
440428

441429
/// We only want this function to type-check, since we will replace the body
442430
/// later on llvm level. Using `loop {}` does not cover all return types anymore,
443-
/// so instead we build something that should pass. We also add a inline_asm
444-
/// line, as one more barrier for rustc to prevent inlining of this function.
445-
/// FIXME(ZuseZ4): We still have cases of incorrect inlining across modules, see
446-
/// <https://github.com/EnzymeAD/rust/issues/173>, so this isn't sufficient.
447-
/// It also triggers an Enzyme crash if we due to a bug ever try to differentiate
448-
/// this function (which should never happen, since it is only a placeholder).
431+
/// so instead we manually build something that should pass the type checker.
432+
/// We also add a inline_asm line, as one more barrier for rustc to prevent inlining
433+
/// or const propagation. inline_asm will also triggers an Enzyme crash if due to another
434+
/// bug would ever try to accidentially differentiate this placeholder function body.
449435
/// Finally, we also add back_box usages of all input arguments, to prevent rustc
450436
/// from optimizing any arguments away.
451437
fn gen_enzyme_body(
@@ -458,7 +444,6 @@ mod llvm_enzyme {
458444
new_names: &[String],
459445
span: Span,
460446
sig_span: Span,
461-
_new_decl_span: Span,
462447
idents: Vec<Ident>,
463448
errored: bool,
464449
) -> P<ast::Block> {

0 commit comments

Comments
 (0)