summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/TargetInfo.cpp
diff options
context:
space:
mode:
authorYaxun Liu <Yaxun.Liu@amd.com>2018-06-12 00:16:33 +0000
committerYaxun Liu <Yaxun.Liu@amd.com>2018-06-12 00:16:33 +0000
commit6c10a66ec7732e8b7afd8ac0260c2e572fbe0a31 (patch)
treef2f1fec310f3a513a61429165579a169f7be6744 /clang/lib/CodeGen/TargetInfo.cpp
parent9deaf68ed1ff782c91cb08b4dd1bd04c7c02653c (diff)
downloadbcm5719-llvm-6c10a66ec7732e8b7afd8ac0260c2e572fbe0a31.tar.gz
bcm5719-llvm-6c10a66ec7732e8b7afd8ac0260c2e572fbe0a31.zip
[CUDA][HIP] Set kernel calling convention before arrange function
Currently clang set kernel calling convention for CUDA/HIP after arranging function, which causes incorrect kernel function type since it depends on calling convention. This patch moves setting kernel convention before arranging function. Differential Revision: https://reviews.llvm.org/D47733 llvm-svn: 334457
Diffstat (limited to 'clang/lib/CodeGen/TargetInfo.cpp')
-rw-r--r--clang/lib/CodeGen/TargetInfo.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/TargetInfo.cpp b/clang/lib/CodeGen/TargetInfo.cpp
index 3ec00553607..b29bcce237c 100644
--- a/clang/lib/CodeGen/TargetInfo.cpp
+++ b/clang/lib/CodeGen/TargetInfo.cpp
@@ -7646,7 +7646,7 @@ public:
llvm::Function *BlockInvokeFunc,
llvm::Value *BlockLiteral) const override;
bool shouldEmitStaticExternCAliases() const override;
- void setCUDAKernelCallingConvention(llvm::Function *F) const override;
+ void setCUDAKernelCallingConvention(const FunctionType *&FT) const override;
};
}
@@ -7783,8 +7783,9 @@ bool AMDGPUTargetCodeGenInfo::shouldEmitStaticExternCAliases() const {
}
void AMDGPUTargetCodeGenInfo::setCUDAKernelCallingConvention(
- llvm::Function *F) const {
- F->setCallingConv(llvm::CallingConv::AMDGPU_KERNEL);
+ const FunctionType *&FT) const {
+ FT = getABIInfo().getContext().adjustFunctionType(
+ FT, FT->getExtInfo().withCallingConv(CC_OpenCLKernel));
}
//===----------------------------------------------------------------------===//
OpenPOWER on IntegriCloud