summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2012-10-29 01:59:03 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2012-10-29 01:59:03 +0000
commit56183fbe7859db3b6ca46eb88797279e7304fc9d (patch)
tree4a516222622687ffcce1780ef04b64de0020afec /llvm/test
parent9d30d0fc674d40005b38d73f210834ce11a56e66 (diff)
downloadbcm5719-llvm-56183fbe7859db3b6ca46eb88797279e7304fc9d.tar.gz
bcm5719-llvm-56183fbe7859db3b6ca46eb88797279e7304fc9d.zip
llvm-extract changes linkages so that functions on both sides of the
split module can see each other. If it is keeping a symbol that already has a non local linkage, it doesn't need to change it. llvm-svn: 166908
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/Other/extract-weak-odr.ll23
-rw-r--r--llvm/test/Other/extract.ll9
2 files changed, 28 insertions, 4 deletions
diff --git a/llvm/test/Other/extract-weak-odr.ll b/llvm/test/Other/extract-weak-odr.ll
new file mode 100644
index 00000000000..6618f584364
--- /dev/null
+++ b/llvm/test/Other/extract-weak-odr.ll
@@ -0,0 +1,23 @@
+; RUN: llvm-extract -func foo -S < %s | FileCheck %s
+; RUN: llvm-extract -delete -func foo -S < %s | FileCheck --check-prefix=DELETE %s
+
+; Test that we don't convert weak_odr to external definitions.
+
+; CHECK: @bar = external global i32
+; CHECK: define weak_odr i32* @foo() {
+; CHECK-NEXT: ret i32* @bar
+; CHECK-NEXT: }
+
+; DELETE: @bar = weak_odr global i32 42
+; DELETE: declare i32* @foo()
+
+@bar = weak_odr global i32 42
+
+define weak_odr i32* @foo() {
+ ret i32* @bar
+}
+
+define void @g() {
+ %c = call i32* @foo()
+ ret void
+}
diff --git a/llvm/test/Other/extract.ll b/llvm/test/Other/extract.ll
index 57573ed76f9..8b0c835d574 100644
--- a/llvm/test/Other/extract.ll
+++ b/llvm/test/Other/extract.ll
@@ -7,18 +7,19 @@
; llvm-extract uses lazy bitcode loading, so make sure it correctly reads
; from bitcode files in addition to assembly files.
-; CHECK: define void @foo() {
+; CHECK: define hidden void @foo() {
; CHECK: ret void
; CHECK: }
-; The linkonce_odr linkage for foo() should be changed to external linkage.
-; DELETE: declare void @foo()
+; The private linkage for foo() should be changed to external linkage and
+; hidden visibility added.
+; DELETE: declare hidden void @foo()
; DELETE: define void @bar() {
; DELETE: call void @foo()
; DELETE: ret void
; DELETE: }
-define linkonce_odr void @foo() {
+define private void @foo() {
ret void
}
define void @bar() {
OpenPOWER on IntegriCloud