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/CGExpr.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'clang/lib/CodeGen/CGExpr.cpp') diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp index a3399af183b5..6457852f1b6d 100644 --- a/clang/lib/CodeGen/CGExpr.cpp +++ b/clang/lib/CodeGen/CGExpr.cpp @@ -4678,12 +4678,12 @@ CGCallee CodeGenFunction::EmitCallee(const Expr *E) { // Resolve direct calls. } else if (auto DRE = dyn_cast(E)) { if (auto FD = dyn_cast(DRE->getDecl())) { - return EmitDirectCallee(*this, CGM.getGlobalDecl(FD)); + return EmitDirectCallee(*this, FD); } } else if (auto ME = dyn_cast(E)) { if (auto FD = dyn_cast(ME->getMemberDecl())) { EmitIgnoredExpr(ME->getBase()); - return EmitDirectCallee(*this, CGM.getGlobalDecl(FD)); + return EmitDirectCallee(*this, FD); } // Look through template substitutions. -- cgit v1.2.3