From 15e678e8438c56703c775fcb45afb25e09b31cff Mon Sep 17 00:00:00 2001 From: Konstantin Pyzhov Date: Mon, 24 Jun 2019 14:40:20 +0000 Subject: [CUDA][HIP] Don't set comdat attribute for CUDA device stub functions.\nDifferential Revision: https://reviews.llvm.org/D63277 llvm-svn: 364183 --- clang/lib/CodeGen/CodeGenModule.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index d0f62beed96..87a1d45abf4 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/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; -- cgit v1.2.3