summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGCUDANV.cpp
diff options
context:
space:
mode:
authorAaron Enye Shi <enye.shi@gmail.com>2019-04-02 20:10:18 +0000
committerAaron Enye Shi <enye.shi@gmail.com>2019-04-02 20:10:18 +0000
commit13d8e929409fb1a1f8a2318250923c90f3abac7c (patch)
tree27aad49cef42e1da44ec25980327a80e50e7d4cd /clang/lib/CodeGen/CGCUDANV.cpp
parent9ca4ff2666299898b657c363e091096a78203898 (diff)
downloadbcm5719-llvm-13d8e929409fb1a1f8a2318250923c90f3abac7c.tar.gz
bcm5719-llvm-13d8e929409fb1a1f8a2318250923c90f3abac7c.zip
[HIP-Clang] Fat binary should not be produced for non GPU code
Skip producing the fat binary functions for HIP when no device code is present. Reviewers: yaxunl Differential Review: https://reviews.llvm.org/D60141 llvm-svn: 357520
Diffstat (limited to 'clang/lib/CodeGen/CGCUDANV.cpp')
-rw-r--r--clang/lib/CodeGen/CGCUDANV.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGCUDANV.cpp b/clang/lib/CodeGen/CGCUDANV.cpp
index 0602601f5e1..cd969dc8972 100644
--- a/clang/lib/CodeGen/CGCUDANV.cpp
+++ b/clang/lib/CodeGen/CGCUDANV.cpp
@@ -472,6 +472,8 @@ llvm::Function *CGNVCUDARuntime::makeModuleCtorFunction() {
StringRef CudaGpuBinaryFileName = CGM.getCodeGenOpts().CudaGpuBinaryFileName;
if (CudaGpuBinaryFileName.empty() && !IsHIP)
return nullptr;
+ if (IsHIP && EmittedKernels.empty() && DeviceVars.empty())
+ return nullptr;
// void __{cuda|hip}_register_globals(void* handle);
llvm::Function *RegisterGlobalsFunc = makeRegisterGlobalsFn();
OpenPOWER on IntegriCloud