summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp5
1 files changed, 5 insertions, 0 deletions
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<CUDAGlobalAttr>())
+ return false;
+
if (D.hasAttr<SelectAnyAttr>())
return true;
OpenPOWER on IntegriCloud