@@ -1143,7 +1143,8 @@ fn codegen_enzyme_autodiff<'ll, 'tcx>(
1143
1143
ty:: FnDef ( def_id, source_params) => ( def_id, source_params) ,
1144
1144
_ => bug ! ( "invalid args" ) ,
1145
1145
} ;
1146
- let fn_source = Instance :: new_raw ( * source_id, source_args) ;
1146
+ let fn_source =
1147
+ Instance :: try_resolve ( tcx, bx. cx . typing_env ( ) , * source_id, source_args) . unwrap ( ) . unwrap ( ) ;
1147
1148
let source_symbol = symbol_name_for_instance_in_crate ( tcx, fn_source. clone ( ) , LOCAL_CRATE ) ;
1148
1149
let fn_to_diff: Option < & ' ll llvm:: Value > = bx. cx . get_function ( & source_symbol) ;
1149
1150
let Some ( fn_to_diff) = fn_to_diff else { bug ! ( "could not find source function" ) } ;
@@ -1152,10 +1153,11 @@ fn codegen_enzyme_autodiff<'ll, 'tcx>(
1152
1153
ty:: FnDef ( def_id, diff_args) => ( def_id, diff_args) ,
1153
1154
_ => bug ! ( "invalid args" ) ,
1154
1155
} ;
1155
- let fn_diff = Instance :: new_raw ( * diff_id, diff_args) ;
1156
+ let fn_diff =
1157
+ Instance :: try_resolve ( tcx, bx. cx . typing_env ( ) , * diff_id, diff_args) . unwrap ( ) . unwrap ( ) ;
1156
1158
let diff_symbol = symbol_name_for_instance_in_crate ( tcx, fn_diff. clone ( ) , LOCAL_CRATE ) ;
1157
1159
1158
- let diff_attrs = autodiff_attrs ( tcx, * diff_id ) ;
1160
+ let diff_attrs = autodiff_attrs ( tcx, fn_diff . def_id ( ) ) ;
1159
1161
let Some ( diff_attrs) = diff_attrs else { bug ! ( "could not find autodiff attrs" ) } ;
1160
1162
1161
1163
// Build body
0 commit comments