================ @@ -3303,6 +3303,27 @@ void CodeGenModule::EmitDeferred() { CurDeclsToEmit.swap(DeferredDeclsToEmit); for (GlobalDecl &D : CurDeclsToEmit) { + // Functions declared with the sycl_kernel_entry_point attribute are + // emitted normally during host compilation. During device compilation, + // a SYCL kernel caller offload entry point function is generated and + // emitted in place of each of these functions. + if (const auto *FD = D.getDecl()->getAsFunction()) { + if (LangOpts.SYCLIsDevice && FD->hasAttr<SYCLKernelEntryPointAttr>() && + FD->isDefined()) { + // Functions with an invalid sycl_kernel_entry_point attribute are + // ignored during device compilation. + if (!FD->getAttr<SYCLKernelEntryPointAttr>()->isInvalidAttr()) { + // Generate and emit the SYCL kernel caller function. + EmitSYCLKernelCaller(FD, getContext()); + // Recurse to emit any symbols directly or indirectly referenced + // by the SYCL kernel caller function. + EmitDeferred(); ---------------- tahonermann wrote:
I misunderstood your question. We can't continue because we don't need or want to emit `D` on the device side and there is no `GlobalDecl` object corresponding to the SYCL kernel caller function that we can substitute for it. The call to `EmitDeferred()` here substitutes for not reaching the call at line 3363. https://github.com/llvm/llvm-project/pull/133030 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits