[Openmp-commits] [clang] [llvm] [openmp] [OpenMP][clang] Indirect and Virtual function call mapping from host to device (PR #159857)

Jason Van Beusekom via Openmp-commits openmp-commits at lists.llvm.org
Wed Jan 21 11:10:48 PST 2026


================
@@ -6824,6 +6824,26 @@ RValue CodeGenFunction::EmitCall(QualType CalleeType,
         Address(Handle, Handle->getType(), CGM.getPointerAlign()));
     Callee.setFunctionPointer(Stub);
   }
+
+  // Insert function pointer lookup if this is a target call
+  //
+  // This is used for the indirect function case, virtual function case is
+  // handled in ItaniumCXXABI.cpp
+  if (getLangOpts().OpenMPIsTargetDevice &&
+      getContext().OMPTargetCalls.contains(E)) {
+    auto *PtrTy = CGM.VoidPtrTy;
+    llvm::Type *RtlFnArgs[] = {PtrTy};
+    llvm::FunctionCallee DeviceRtlFn = CGM.CreateRuntimeFunction(
+        llvm::FunctionType::get(PtrTy, RtlFnArgs, false),
+        "__llvm_omp_indirect_call_lookup");
----------------
Jason-Van-Beusekom wrote:

This was originally `__kmpc_omp_indirect_call_lookup` but was changed to `__llvm_omp_indirect_call_lookup` after feedback from @jhuber6.

The main argument was to be more inline with other API functions, looking back at the comment it looks like unfortunately with the rebase to be include the changes in https://github.com/llvm/llvm-project/pull/167011
and https://github.com/llvm/llvm-project/pull/159856 the history of this change was lost. 

https://github.com/llvm/llvm-project/pull/159857


More information about the Openmp-commits mailing list