From c0a0363d5c269dc955c48345bf6b8e39d1c49e8b Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Wed, 25 May 2016 18:36:22 +0000 Subject: [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 --- llvm/lib/IR/Globals.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'llvm/lib/IR/Globals.cpp') 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(Src)) { setAlignment(GV->getAlignment()); setSection(GV->getSection()); + setComdat(const_cast(GV)->getComdat()); } } -- cgit v1.2.3