From 4fab8765b95e6a03cd513b2c4cb487d2c711fde2 Mon Sep 17 00:00:00 2001 From: Konstantin Pyzhov Date: Mon, 24 Jun 2019 14:40:20 +0000 Subject: [PATCH] [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 --- lib/CodeGen/CodeGenModule.cpp | 5 +++++ 1 file changed, 5 insertions(+) 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; -- 2.40.0