From: Konstantin Pyzhov Date: Mon, 24 Jun 2019 14:40:20 +0000 (+0000) Subject: [CUDA][HIP] Don't set comdat attribute for CUDA device stub functions.\nDifferential... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4fab8765b95e6a03cd513b2c4cb487d2c711fde2;p=clang [CUDA][HIP] Don't set comdat attribute for CUDA device stub functions.\nDifferential Revision: https://reviews.llvm.org/D63277 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@364183 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index d0f62beed9..87a1d45abf 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/lib/CodeGen/CodeGenModule.cpp @@ -3712,6 +3712,11 @@ static bool shouldBeInCOMDAT(CodeGenModule &CGM, const Decl &D) { if (!CGM.supportsCOMDAT()) return false; + // Do not set COMDAT attribute for CUDA/HIP stub functions to prevent + // them being "merged" by the COMDAT Folding linker optimization. + if (D.hasAttr()) + return false; + if (D.hasAttr()) return true;