@@ -12,21 +12,15 @@ fn adjust_activity_to_abi<'tcx>(tcx: TyCtxt<'tcx>, fn_ty: Ty<'tcx>, da: &mut Vec
12
12
if !matches ! ( fn_ty. kind( ) , ty:: FnDef ( ..) ) {
13
13
bug ! ( "expected fn def for autodiff, got {:?}" , fn_ty) ;
14
14
}
15
- let fnc_binder: ty:: Binder < ' _ , ty:: FnSig < ' _ > > = fn_ty. fn_sig ( tcx) ;
16
15
17
- // If rustc compiles the unmodified primal, we know that this copy of the function
18
- // also has correct lifetimes. We know that Enzyme won't free the shadow too early
19
- // (or actually at all), so let's strip lifetimes when computing the layout.
20
- let x = tcx . instantiate_bound_regions_with_erased ( fnc_binder ) ;
16
+ // We don't actually pass the types back into the type system.
17
+ // All we do is decide how to handle the arguments.
18
+ let sig = fn_ty . fn_sig ( tcx ) . skip_binder ( ) ;
19
+
21
20
let mut new_activities = vec ! [ ] ;
22
21
let mut new_positions = vec ! [ ] ;
23
- for ( i, ty) in x . inputs ( ) . iter ( ) . enumerate ( ) {
22
+ for ( i, ty) in sig . inputs ( ) . iter ( ) . enumerate ( ) {
24
23
if let Some ( inner_ty) = ty. builtin_deref ( true ) {
25
- if ty. is_fn_ptr ( ) {
26
- // FIXME(ZuseZ4): add a nicer error, or just figure out how to support them,
27
- // since Enzyme itself can handle them.
28
- tcx. dcx ( ) . err ( "function pointers are currently not supported in autodiff" ) ;
29
- }
30
24
if inner_ty. is_slice ( ) {
31
25
// We know that the length will be passed as extra arg.
32
26
if !da. is_empty ( ) {
0 commit comments