summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorMichael Liao <michael.hliao@gmail.com>2019-06-17 12:51:36 +0000
committerMichael Liao <michael.hliao@gmail.com>2019-06-17 12:51:36 +0000
commite40f879eb2cbe0571e0ddaaf17c30792326f9f68 (patch)
treeb64a97836cd01a35cab7b618b53726e65ed85617 /clang/lib/CodeGen/CodeGenModule.cpp
parentf1e2827170b3a93f85beae334b29bb98575de2e5 (diff)
downloadbcm5719-llvm-e40f879eb2cbe0571e0ddaaf17c30792326f9f68.tar.gz
bcm5719-llvm-e40f879eb2cbe0571e0ddaaf17c30792326f9f68.zip
[HIP] Add the interface deriving the stub name of device kernels.
Summary: - Revise the interface to derive the stub name and simplify the assertion of it. Reviewers: yaxunl, tra Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63335 llvm-svn: 363553
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 7edac4d0114..559f3a73d38 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -1088,13 +1088,11 @@ StringRef CodeGenModule::getMangledName(GlobalDecl GD) {
const auto *ND = cast<NamedDecl>(GD.getDecl());
std::string MangledName = getMangledNameImpl(*this, GD, ND);
- // Postfix kernel stub names with .stub to differentiate them from kernel
- // names in device binaries. This is to facilitate the debugger to find
- // the correct symbols for kernels in the device binary.
+ // Adjust kernel stub mangling as we may need to be able to differentiate
+ // them from the kernel itself (e.g., for HIP).
if (auto *FD = dyn_cast<FunctionDecl>(GD.getDecl()))
- if (getLangOpts().HIP && !getLangOpts().CUDAIsDevice &&
- FD->hasAttr<CUDAGlobalAttr>())
- MangledName = MangledName + ".stub";
+ if (!getLangOpts().CUDAIsDevice && FD->hasAttr<CUDAGlobalAttr>())
+ MangledName = getCUDARuntime().getDeviceStubName(MangledName);
auto Result = Manglings.insert(std::make_pair(MangledName, GD));
return MangledDeclNames[CanonicalGD] = Result.first->first();
OpenPOWER on IntegriCloud