Add a passing test.
authorRafael Espindola <rafael.espindola@gmail.com>
Sun, 29 Nov 2015 15:52:12 +0000 (15:52 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Sun, 29 Nov 2015 15:52:12 +0000 (15:52 +0000)
When a comdat is discarded, any globals defined in it become undefined.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254258 91177308-0d34-0410-b5e6-96231b3b80d8

test/tools/gold/X86/Inputs/comdat2.ll [new file with mode: 0644]
test/tools/gold/X86/comdat2.ll [new file with mode: 0644]

diff --git a/test/tools/gold/X86/Inputs/comdat2.ll b/test/tools/gold/X86/Inputs/comdat2.ll
new file mode 100644 (file)
index 0000000..5b7f74c
--- /dev/null
@@ -0,0 +1,9 @@
+$foo = comdat any
+@foo = global i8 1, comdat
+define void @zed() {
+  call void @bar()
+  ret void
+}
+define void @bar() comdat($foo) {
+  ret void
+}
diff --git a/test/tools/gold/X86/comdat2.ll b/test/tools/gold/X86/comdat2.ll
new file mode 100644 (file)
index 0000000..2156efd
--- /dev/null
@@ -0,0 +1,19 @@
+; RUN: llvm-as %s -o %t.bc
+; RUN: llvm-as %p/Inputs/comdat2.ll -o %t2.bc
+; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
+; RUN:    --plugin-opt=emit-llvm \
+; RUN:    -shared %t.bc %t2.bc -o %t3.bc
+; RUN: llvm-dis %t3.bc -o - | FileCheck %s
+
+
+$foo = comdat any
+@foo = global i8 0, comdat
+
+; CHECK: @foo = global i8 0, comdat
+
+; CHECK: define void @zed() {
+; CHECK:   call void @bar()
+; CHECK:   ret void
+; CHECK: }
+
+; CHECK: declare void @bar()