[clang] [Clang][OpenCL][AMDGPU] Allow a kernel to call another kernel (PR #115821)
Aniket Lal via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 19 01:28:29 PDT 2025
================
@@ -6138,6 +6150,17 @@ void CodeGenModule::EmitGlobalFunctionDefinition(GlobalDecl GD,
CodeGenFunction(*this).GenerateCode(GD, Fn, FI);
setNonAliasAttributes(GD, Fn);
+
+ if (D->hasAttr<OpenCLKernelAttr>()) {
+ if (GD.getKernelReferenceKind() == KernelReferenceKind::Stub) {
+ if (Fn->hasFnAttribute(llvm::Attribute::NoInline))
+ Fn->removeFnAttr(llvm::Attribute::NoInline);
+ if (Fn->hasFnAttribute(llvm::Attribute::InlineHint))
+ Fn->removeFnAttr(llvm::Attribute::InlineHint);
+ Fn->addFnAttr(llvm::Attribute::AlwaysInline);
+ }
+ }
----------------
lalaniket8 wrote:
I see, yes it seems that adding the alwaysinline attribute is not necessary. I have removed it in the latest commit and made required changes in the test files.
https://github.com/llvm/llvm-project/pull/115821
More information about the cfe-commits
mailing list