From 4cf01ed75e35e7bd3ef8ef1a2192c7f4656ab545 Mon Sep 17 00:00:00 2001 From: Michael Liao Date: Wed, 18 Mar 2020 01:43:20 -0400 Subject: [hip] Revise `GlobalDecl` constructors. NFC. Summary: - https://reviews.llvm.org/D68578 revises the `GlobalDecl` constructors to ensure all GPU kernels have `ReferenceKenelKind` initialized properly with an explicit constructor and static one. But, there are lots of places using the implicit constructor triggering the assertion on non-GPU kernels. That's found in compilation of many tests and workloads. - Fixing all of them may change more code and, more importantly, all of them assumes the default kernel reference kind. This patch changes that constructor to tell `CUDAGlobalAttr` and construct `GlobalDecl` properly. Reviewers: yaxunl Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D76344 --- clang/lib/CodeGen/CodeGenModule.cpp | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 4ece40bd9fe0..cd77a727231b 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -5302,7 +5302,7 @@ void CodeGenModule::EmitTopLevelDecl(Decl *D) { case Decl::CXXConversion: case Decl::CXXMethod: case Decl::Function: - EmitGlobal(getGlobalDecl(cast(D))); + EmitGlobal(cast(D)); // Always provide some coverage mapping // even for the functions that aren't emitted. AddDeferredUnusedCoverageMapping(D); @@ -5964,10 +5964,3 @@ CodeGenModule::createOpenCLIntToSamplerConversion(const Expr *E, "__translate_sampler_initializer"), {C}); } - -GlobalDecl CodeGenModule::getGlobalDecl(const FunctionDecl *FD) { - if (FD->hasAttr()) - return GlobalDecl::getDefaultKernelReference(FD); - else - return GlobalDecl(FD); -} -- cgit v1.2.3