summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReid Kleckner <reid@kleckner.net>2015-07-06 18:48:02 +0000
committerReid Kleckner <reid@kleckner.net>2015-07-06 18:48:02 +0000
commitfc0f93832b12677d2e7356dea93e9990dc79f9f5 (patch)
treea5dd5a8fc4e8eaaf2f465db66b81f835ac6b9675
parentc1f705c2298d64edd5d54ca59816332cce34869b (diff)
downloadbcm5719-llvm-fc0f93832b12677d2e7356dea93e9990dc79f9f5.tar.gz
bcm5719-llvm-fc0f93832b12677d2e7356dea93e9990dc79f9f5.zip
[llvm-extract] Drop comdats from declarations
The verifier rejects comdats on declarations. llvm-svn: 241483
-rw-r--r--llvm/lib/Transforms/IPO/ExtractGV.cpp10
-rw-r--r--llvm/test/Other/extract.ll7
2 files changed, 13 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/IPO/ExtractGV.cpp b/llvm/lib/Transforms/IPO/ExtractGV.cpp
index 2f8c7d9349b..b9462f2ffc7 100644
--- a/llvm/lib/Transforms/IPO/ExtractGV.cpp
+++ b/llvm/lib/Transforms/IPO/ExtractGV.cpp
@@ -93,8 +93,11 @@ namespace {
makeVisible(*I, Delete);
- if (Delete)
+ if (Delete) {
+ // Make this a declaration and drop it's comdat.
I->setInitializer(nullptr);
+ I->setComdat(nullptr);
+ }
}
// Visit the Functions.
@@ -108,8 +111,11 @@ namespace {
makeVisible(*I, Delete);
- if (Delete)
+ if (Delete) {
+ // Make this a declaration and drop it's comdat.
I->deleteBody();
+ I->setComdat(nullptr);
+ }
}
// Visit the Aliases.
diff --git a/llvm/test/Other/extract.ll b/llvm/test/Other/extract.ll
index 8b0c835d574..08675d8bff3 100644
--- a/llvm/test/Other/extract.ll
+++ b/llvm/test/Other/extract.ll
@@ -7,19 +7,22 @@
; llvm-extract uses lazy bitcode loading, so make sure it correctly reads
; from bitcode files in addition to assembly files.
-; CHECK: define hidden void @foo() {
+; CHECK: define hidden void @foo() comdat($x) {
; CHECK: ret void
; CHECK: }
; The private linkage for foo() should be changed to external linkage and
; hidden visibility added.
; DELETE: declare hidden void @foo()
+; DELETE-NOT: comdat
; DELETE: define void @bar() {
; DELETE: call void @foo()
; DELETE: ret void
; DELETE: }
-define private void @foo() {
+$x = comdat any
+
+define private void @foo() comdat($x) {
ret void
}
define void @bar() {
OpenPOWER on IntegriCloud