summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorGeorge Rokos <grokos@us.ibm.com>2017-05-27 03:03:13 +0000
committerGeorge Rokos <grokos@us.ibm.com>2017-05-27 03:03:13 +0000
commit29d0f003403fe8289f776d81e0965a93cd0b1670 (patch)
tree05d17c8e2524309bdb8670573e140b5be576af68 /clang/lib/CodeGen/CodeGenModule.cpp
parent868bbd40226d6bd9d909e3ae3645e580ff9e2352 (diff)
downloadbcm5719-llvm-29d0f003403fe8289f776d81e0965a93cd0b1670.tar.gz
bcm5719-llvm-29d0f003403fe8289f776d81e0965a93cd0b1670.zip
[OpenMP] Create COMDAT group for OpenMP offload registration code to avoid multiple copies
Thanks to Sergey Dmitriev for submitting the patch. Differential Revision: https://reviews.llvm.org/D33509 llvm-svn: 304056
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index db8f8d32abb..ffbcbfcc291 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -400,8 +400,11 @@ void CodeGenModule::Release() {
}
if (OpenMPRuntime)
if (llvm::Function *OpenMPRegistrationFunction =
- OpenMPRuntime->emitRegistrationFunction())
- AddGlobalCtor(OpenMPRegistrationFunction, 0);
+ OpenMPRuntime->emitRegistrationFunction()) {
+ auto ComdatKey = OpenMPRegistrationFunction->hasComdat() ?
+ OpenMPRegistrationFunction : nullptr;
+ AddGlobalCtor(OpenMPRegistrationFunction, 0, ComdatKey);
+ }
if (PGOReader) {
getModule().setProfileSummary(PGOReader->getSummary().getMD(VMContext));
if (PGOStats.hasDiagnostics())
OpenPOWER on IntegriCloud