summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r--clang/lib/CodeGen/TargetInfo.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/TargetInfo.cpp b/clang/lib/CodeGen/TargetInfo.cpp
index 4ee85730497..4448057a37f 100644
--- a/clang/lib/CodeGen/TargetInfo.cpp
+++ b/clang/lib/CodeGen/TargetInfo.cpp
@@ -6826,6 +6826,14 @@ void AMDGPUTargetCodeGenInfo::setTargetAttributes(
if (!FD)
return;
+ if (M.getLangOpts().OpenCL) {
+ if (FD->hasAttr<OpenCLKernelAttr>()) {
+ // Set amdgpu_kernel calling convention for OpenCL kernels.
+ llvm::Function *Fn = cast<llvm::Function>(GV);
+ Fn->setCallingConv(llvm::CallingConv::AMDGPU_KERNEL);
+ }
+ }
+
if (const auto Attr = FD->getAttr<AMDGPUNumVGPRAttr>()) {
llvm::Function *F = cast<llvm::Function>(GV);
uint32_t NumVGPR = Attr->getNumVGPR();
OpenPOWER on IntegriCloud