[clang] [Clang][OpenCL][AMDGPU] Allow a kernel to call another kernel (PR #115821)

Aniket Lal via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 27 02:31:53 PST 2025


================
@@ -5692,7 +5692,10 @@ CGCallee CodeGenFunction::EmitCallee(const Expr *E) {
   // Resolve direct calls.
   } else if (auto DRE = dyn_cast<DeclRefExpr>(E)) {
     if (auto FD = dyn_cast<FunctionDecl>(DRE->getDecl())) {
-      return EmitDirectCallee(*this, FD);
+      auto CalleeDecl = FD->hasAttr<OpenCLKernelAttr>()
+                            ? GlobalDecl(FD, KernelReferenceKind::Stub)
+                            : FD;
+      return EmitDirectCallee(*this, CalleeDecl);
----------------
lalaniket8 wrote:

I see, I can get the correct CalleePtr which is of type `llvm::Constant`, but I am not able to figure out how to convert the same into a `GlobalDecl` object.

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


More information about the cfe-commits mailing list