We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1b7de4b commit 829a3f0Copy full SHA for 829a3f0
1 file changed
compiler/rustc_codegen_llvm/src/builder/gpu_offload.rs
@@ -57,6 +57,12 @@ impl<'ll> OffloadGlobals<'ll> {
57
}
58
59
pub(crate) fn register_offload<'ll>(cx: &CodegenCx<'ll, '_>) {
60
+ // First we check quickly whether we already have done our setup,
61
+ // in which case we can return early. Shouldn't affect correctness.
62
+ if cx.get_function("__tgt_register_lib").is_some() {
63
+ return;
64
+ }
65
+
66
let reg_lib_decl = cx.type_func(&[cx.type_ptr()], cx.type_void());
67
let register_lib = declare_offload_fn(&cx, "__tgt_register_lib", reg_lib_decl);
68
let unregister_lib = declare_offload_fn(&cx, "__tgt_unregister_lib", reg_lib_decl);
0 commit comments