From e40f879eb2cbe0571e0ddaaf17c30792326f9f68 Mon Sep 17 00:00:00 2001 From: Michael Liao Date: Mon, 17 Jun 2019 12:51:36 +0000 Subject: [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 --- clang/lib/CodeGen/CodeGenModule.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') 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(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(GD.getDecl())) - if (getLangOpts().HIP && !getLangOpts().CUDAIsDevice && - FD->hasAttr()) - MangledName = MangledName + ".stub"; + if (!getLangOpts().CUDAIsDevice && FD->hasAttr()) + MangledName = getCUDARuntime().getDeviceStubName(MangledName); auto Result = Manglings.insert(std::make_pair(MangledName, GD)); return MangledDeclNames[CanonicalGD] = Result.first->first(); -- cgit v1.2.3