Skip to content

Commit b563bbf

Browse files
committed
Fix how fns where being retrieved at intrinsic cg
1 parent e60c3f0 commit b563bbf

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

compiler/rustc_codegen_llvm/src/intrinsic.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1143,7 +1143,8 @@ fn codegen_enzyme_autodiff<'ll, 'tcx>(
11431143
ty::FnDef(def_id, source_params) => (def_id, source_params),
11441144
_ => bug!("invalid args"),
11451145
};
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();
11471148
let source_symbol = symbol_name_for_instance_in_crate(tcx, fn_source.clone(), LOCAL_CRATE);
11481149
let fn_to_diff: Option<&'ll llvm::Value> = bx.cx.get_function(&source_symbol);
11491150
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>(
11521153
ty::FnDef(def_id, diff_args) => (def_id, diff_args),
11531154
_ => bug!("invalid args"),
11541155
};
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();
11561158
let diff_symbol = symbol_name_for_instance_in_crate(tcx, fn_diff.clone(), LOCAL_CRATE);
11571159

1158-
let diff_attrs = autodiff_attrs(tcx, *diff_id);
1160+
let diff_attrs = autodiff_attrs(tcx, fn_diff.def_id());
11591161
let Some(diff_attrs) = diff_attrs else { bug!("could not find autodiff attrs") };
11601162

11611163
// Build body

0 commit comments

Comments
 (0)