aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenFunction.cpp
diff options
context:
space:
mode:
authorNick Sarnie <nick.sarnie@intel.com>2025-06-05 10:15:38 -0400
committerGitHub <noreply@github.com>2025-06-05 14:15:38 +0000
commit3b9ebe92011b033523217a9b9a2f03f4c8c37aab (patch)
treebb519b3f1df97024db7a14874c82ae0fd65b6d7d /clang/lib/CodeGen/CodeGenFunction.cpp
parentb2379bd5d59993c0d859ad90f9f5cdfcfce26e71 (diff)
downloadllvm-3b9ebe92011b033523217a9b9a2f03f4c8c37aab.zip
llvm-3b9ebe92011b033523217a9b9a2f03f4c8c37aab.tar.gz
llvm-3b9ebe92011b033523217a9b9a2f03f4c8c37aab.tar.bz2
[clang] Simplify device kernel attributes (#137882)
We have multiple different attributes in clang representing device kernels for specific targets/languages. Refactor them into one attribute with different spellings to make it more easily scalable for new languages/targets. --------- Signed-off-by: Sarnie, Nick <nick.sarnie@intel.com>
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
index 2ac7e9d..3302abad 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
@@ -626,7 +626,7 @@ CodeGenFunction::getUBSanFunctionTypeHash(QualType Ty) const {
void CodeGenFunction::EmitKernelMetadata(const FunctionDecl *FD,
llvm::Function *Fn) {
- if (!FD->hasAttr<OpenCLKernelAttr>() && !FD->hasAttr<CUDAGlobalAttr>())
+ if (!FD->hasAttr<DeviceKernelAttr>() && !FD->hasAttr<CUDAGlobalAttr>())
return;
llvm::LLVMContext &Context = getLLVMContext();
@@ -1598,7 +1598,8 @@ void CodeGenFunction::GenerateCode(GlobalDecl GD, llvm::Function *Fn,
// Implicit copy-assignment gets the same special treatment as implicit
// copy-constructors.
emitImplicitAssignmentOperatorBody(Args);
- } else if (FD->hasAttr<OpenCLKernelAttr>() &&
+ } else if (DeviceKernelAttr::isOpenCLSpelling(
+ FD->getAttr<DeviceKernelAttr>()) &&
GD.getKernelReferenceKind() == KernelReferenceKind::Kernel) {
CallArgList CallArgs;
for (unsigned i = 0; i < Args.size(); ++i) {