summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2018-01-31 02:51:03 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2018-01-31 02:51:03 +0000
commit7873669be5cd38129508d34ca8200ac7af883bc4 (patch)
tree411b87b87a7953d9ebf10a988f74dcb69abb8070
parentfce6112a8748668659f5604d645865d20757039a (diff)
downloadbcm5719-llvm-7873669be5cd38129508d34ca8200ac7af883bc4.tar.gz
bcm5719-llvm-7873669be5cd38129508d34ca8200ac7af883bc4.zip
LTO: Drop comdats when converting definitions to declarations.
Differential Revision: https://reviews.llvm.org/D42715 llvm-svn: 323844
-rw-r--r--llvm/lib/Transforms/IPO/FunctionImport.cpp2
-rw-r--r--llvm/test/LTO/Resolution/X86/not-prevailing.ll3
2 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/IPO/FunctionImport.cpp b/llvm/lib/Transforms/IPO/FunctionImport.cpp
index 8dbee83bc3e..408d1819bde 100644
--- a/llvm/lib/Transforms/IPO/FunctionImport.cpp
+++ b/llvm/lib/Transforms/IPO/FunctionImport.cpp
@@ -618,10 +618,12 @@ void llvm::convertToDeclaration(GlobalValue &GV) {
if (Function *F = dyn_cast<Function>(&GV)) {
F->deleteBody();
F->clearMetadata();
+ F->setComdat(nullptr);
} else if (GlobalVariable *V = dyn_cast<GlobalVariable>(&GV)) {
V->setInitializer(nullptr);
V->setLinkage(GlobalValue::ExternalLinkage);
V->clearMetadata();
+ V->setComdat(nullptr);
} else
// For now we don't resolve or drop aliases. Once we do we'll
// need to add support here for creating either a function or
diff --git a/llvm/test/LTO/Resolution/X86/not-prevailing.ll b/llvm/test/LTO/Resolution/X86/not-prevailing.ll
index 36d86ca9104..58c77247242 100644
--- a/llvm/test/LTO/Resolution/X86/not-prevailing.ll
+++ b/llvm/test/LTO/Resolution/X86/not-prevailing.ll
@@ -24,7 +24,8 @@
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
-define weak i32 @foo() {
+$foo = comdat any
+define weak i32 @foo() comdat {
ret i32 65
}
OpenPOWER on IntegriCloud