summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
diff options
context:
space:
mode:
authorAaron Enye Shi <enye.shi@gmail.com>2019-04-02 20:49:41 +0000
committerAaron Enye Shi <enye.shi@gmail.com>2019-04-02 20:49:41 +0000
commit8129521318accc44c2a009647572f6ebd3fc56dd (patch)
tree6661b70fd54aaa9c86d032af4904882b1e307640 /clang/lib/CodeGen
parent19775a4c673aa94f414448818ad28d8a3235acb6 (diff)
downloadbcm5719-llvm-8129521318accc44c2a009647572f6ebd3fc56dd.tar.gz
bcm5719-llvm-8129521318accc44c2a009647572f6ebd3fc56dd.zip
[HIP-Clang] Fat binary should not be produced for non GPU code 2
Also for CUDA, we need to disable producing these fat binary functions when there is no GPU code. Reviewers: yaxunl, tra Differential Revision: https://reviews.llvm.org/D60141 llvm-svn: 357526
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r--clang/lib/CodeGen/CGCUDANV.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGCUDANV.cpp b/clang/lib/CodeGen/CGCUDANV.cpp
index cd969dc8972..913d58e0178 100644
--- a/clang/lib/CodeGen/CGCUDANV.cpp
+++ b/clang/lib/CodeGen/CGCUDANV.cpp
@@ -468,11 +468,13 @@ llvm::Function *CGNVCUDARuntime::makeRegisterGlobalsFn() {
/// \endcode
llvm::Function *CGNVCUDARuntime::makeModuleCtorFunction() {
bool IsHIP = CGM.getLangOpts().HIP;
+ bool IsCUDA = CGM.getLangOpts().CUDA;
// No need to generate ctors/dtors if there is no GPU binary.
StringRef CudaGpuBinaryFileName = CGM.getCodeGenOpts().CudaGpuBinaryFileName;
if (CudaGpuBinaryFileName.empty() && !IsHIP)
return nullptr;
- if (IsHIP && EmittedKernels.empty() && DeviceVars.empty())
+ if ( (IsHIP || (IsCUDA && !RelocatableDeviceCode) )
+ && EmittedKernels.empty() && DeviceVars.empty())
return nullptr;
// void __{cuda|hip}_register_globals(void* handle);
OpenPOWER on IntegriCloud