summaryrefslogtreecommitdiff
path: root/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
commit9cb90e7c1578de19d00806cc121a8ef5ad6c9089 (patch)
tree065f8cdfa901540cf70cc0951937fed4851f2c58 /test
parentc0916d30e09192b7023e453aaa7d2ffe026345ed (diff)
downloadllvm-9cb90e7c1578de19d00806cc121a8ef5ad6c9089.tar.gz
llvm-9cb90e7c1578de19d00806cc121a8ef5ad6c9089.tar.bz2
llvm-9cb90e7c1578de19d00806cc121a8ef5ad6c9089.tar.xz
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166908 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/Other/extract-weak-odr.ll23
-rw-r--r--test/Other/extract.ll9
2 files changed, 28 insertions, 4 deletions
diff --git a/test/Other/extract-weak-odr.ll b/test/Other/extract-weak-odr.ll
new file mode 100644
index 0000000000..6618f58436
--- /dev/null
+++ b/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/test/Other/extract.ll b/test/Other/extract.ll
index 57573ed76f..8b0c835d57 100644
--- a/test/Other/extract.ll
+++ b/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() {