aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenFunction.cpp
diff options
context:
space:
mode:
authorAlexander Shaposhnikov <ashaposhnikov@google.com>2024-11-19 13:14:45 -0800
committerGitHub <noreply@github.com>2024-11-19 13:14:45 -0800
commitdf13acf344a4233777789d0052b3d09bec6a5180 (patch)
tree3c1ed1c931802d7774ee81151305c0e8ea845ec0 /clang/lib/CodeGen/CodeGenFunction.cpp
parent174899f738b31216750ac59562475966b0b0be42 (diff)
downloadllvm-df13acf344a4233777789d0052b3d09bec6a5180.zip
llvm-df13acf344a4233777789d0052b3d09bec6a5180.tar.gz
llvm-df13acf344a4233777789d0052b3d09bec6a5180.tar.bz2
[CudaSPIRV] Add support for optional spir-v attributes (#116589)
Add support for optional spir-v attributes. Test plan: ninja check-all
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
index e2437d1..ef6bb4f 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
@@ -635,7 +635,9 @@ void CodeGenFunction::EmitKernelMetadata(const FunctionDecl *FD,
CGM.GenKernelArgMetadata(Fn, FD, this);
- if (!getLangOpts().OpenCL)
+ if (!(getLangOpts().OpenCL ||
+ (getLangOpts().CUDA &&
+ getContext().getTargetInfo().getTriple().isSPIRV())))
return;
if (const VecTypeHintAttr *A = FD->getAttr<VecTypeHintAttr>()) {
@@ -1022,6 +1024,8 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy,
}
if (FD && (getLangOpts().OpenCL ||
+ (getLangOpts().CUDA &&
+ getContext().getTargetInfo().getTriple().isSPIRV()) ||
((getLangOpts().HIP || getLangOpts().OffloadViaLLVM) &&
getLangOpts().CUDAIsDevice))) {
// Add metadata for a kernel function.