summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/Globals.cpp
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2016-05-25 18:36:22 +0000
committerReid Kleckner <rnk@google.com>2016-05-25 18:36:22 +0000
commitc0a0363d5c269dc955c48345bf6b8e39d1c49e8b (patch)
treefc283f4c7ead812732ad81719a43184b8775cdab /llvm/lib/IR/Globals.cpp
parentd8ca0522e7fb5b1f77d7a1a996c4140325a7eea6 (diff)
downloadbcm5719-llvm-c0a0363d5c269dc955c48345bf6b8e39d1c49e8b.tar.gz
bcm5719-llvm-c0a0363d5c269dc955c48345bf6b8e39d1c49e8b.zip
[IR] Copy comdats in GlobalObject::copyAttributesFrom
This is probably correct for all uses except cross-module IR linking, where we need to move the comdat from the source module to the destination module. Fixes PR27870. Reviewers: majnemer Differential Revision: http://reviews.llvm.org/D20631 llvm-svn: 270743
Diffstat (limited to 'llvm/lib/IR/Globals.cpp')
-rw-r--r--llvm/lib/IR/Globals.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/llvm/lib/IR/Globals.cpp b/llvm/lib/IR/Globals.cpp
index 7e8ef6526fc..3bf3cc25455 100644
--- a/llvm/lib/IR/Globals.cpp
+++ b/llvm/lib/IR/Globals.cpp
@@ -96,6 +96,7 @@ void GlobalObject::copyAttributesFrom(const GlobalValue *Src) {
if (const auto *GV = dyn_cast<GlobalObject>(Src)) {
setAlignment(GV->getAlignment());
setSection(GV->getSection());
+ setComdat(const_cast<GlobalObject *>(GV)->getComdat());
}
}
OpenPOWER on IntegriCloud