Split the gold tests into X86 and PowerPC directories.
authorRafael Espindola <rafael.espindola@gmail.com>
Fri, 28 Aug 2015 20:33:56 +0000 (20:33 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Fri, 28 Aug 2015 20:33:56 +0000 (20:33 +0000)
Patch by Than McIntosh!

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

63 files changed:
test/tools/gold/Inputs/alias-1.ll [deleted file]
test/tools/gold/Inputs/bcsection.s [deleted file]
test/tools/gold/Inputs/comdat.ll [deleted file]
test/tools/gold/Inputs/common.ll [deleted file]
test/tools/gold/Inputs/drop-debug.bc [deleted file]
test/tools/gold/Inputs/invalid.bc [deleted file]
test/tools/gold/Inputs/linker-script.export [deleted file]
test/tools/gold/Inputs/linkonce-weak.ll [deleted file]
test/tools/gold/Inputs/pr19901-1.ll [deleted file]
test/tools/gold/Inputs/weak.ll [deleted file]
test/tools/gold/PowerPC/lit.local.cfg [new file with mode: 0644]
test/tools/gold/PowerPC/mtriple.ll [new file with mode: 0644]
test/tools/gold/X86/Inputs/alias-1.ll [new file with mode: 0644]
test/tools/gold/X86/Inputs/bcsection.s [new file with mode: 0644]
test/tools/gold/X86/Inputs/comdat.ll [new file with mode: 0644]
test/tools/gold/X86/Inputs/common.ll [new file with mode: 0644]
test/tools/gold/X86/Inputs/drop-debug.bc [new file with mode: 0644]
test/tools/gold/X86/Inputs/invalid.bc [new file with mode: 0644]
test/tools/gold/X86/Inputs/linker-script.export [new file with mode: 0644]
test/tools/gold/X86/Inputs/linkonce-weak.ll [new file with mode: 0644]
test/tools/gold/X86/Inputs/pr19901-1.ll [new file with mode: 0644]
test/tools/gold/X86/Inputs/weak.ll [new file with mode: 0644]
test/tools/gold/X86/alias.ll [new file with mode: 0644]
test/tools/gold/X86/bad-alias.ll [new file with mode: 0644]
test/tools/gold/X86/bcsection.ll [new file with mode: 0644]
test/tools/gold/X86/coff.ll [new file with mode: 0644]
test/tools/gold/X86/comdat.ll [new file with mode: 0644]
test/tools/gold/X86/common.ll [new file with mode: 0644]
test/tools/gold/X86/drop-debug.ll [new file with mode: 0644]
test/tools/gold/X86/emit-llvm.ll [new file with mode: 0644]
test/tools/gold/X86/invalid.ll [new file with mode: 0644]
test/tools/gold/X86/linker-script.ll [new file with mode: 0644]
test/tools/gold/X86/linkonce-weak.ll [new file with mode: 0644]
test/tools/gold/X86/lit.local.cfg [new file with mode: 0644]
test/tools/gold/X86/no-map-whole-file.ll [new file with mode: 0644]
test/tools/gold/X86/opt-level.ll [new file with mode: 0644]
test/tools/gold/X86/pr19901.ll [new file with mode: 0644]
test/tools/gold/X86/remarks.ll [new file with mode: 0644]
test/tools/gold/X86/slp-vectorize.ll [new file with mode: 0644]
test/tools/gold/X86/stats.ll [new file with mode: 0644]
test/tools/gold/X86/vectorize.ll [new file with mode: 0644]
test/tools/gold/X86/weak.ll [new file with mode: 0644]
test/tools/gold/alias.ll [deleted file]
test/tools/gold/bad-alias.ll [deleted file]
test/tools/gold/bcsection.ll [deleted file]
test/tools/gold/coff.ll [deleted file]
test/tools/gold/comdat.ll [deleted file]
test/tools/gold/common.ll [deleted file]
test/tools/gold/drop-debug.ll [deleted file]
test/tools/gold/emit-llvm.ll [deleted file]
test/tools/gold/invalid.ll [deleted file]
test/tools/gold/linker-script.ll [deleted file]
test/tools/gold/linkonce-weak.ll [deleted file]
test/tools/gold/lit.local.cfg [deleted file]
test/tools/gold/mtriple.ll [deleted file]
test/tools/gold/no-map-whole-file.ll [deleted file]
test/tools/gold/opt-level.ll [deleted file]
test/tools/gold/pr19901.ll [deleted file]
test/tools/gold/remarks.ll [deleted file]
test/tools/gold/slp-vectorize.ll [deleted file]
test/tools/gold/stats.ll [deleted file]
test/tools/gold/vectorize.ll [deleted file]
test/tools/gold/weak.ll [deleted file]

diff --git a/test/tools/gold/Inputs/alias-1.ll b/test/tools/gold/Inputs/alias-1.ll
deleted file mode 100644 (file)
index 96183aa..0000000
+++ /dev/null
@@ -1 +0,0 @@
-@a = global i32 42
diff --git a/test/tools/gold/Inputs/bcsection.s b/test/tools/gold/Inputs/bcsection.s
deleted file mode 100644 (file)
index ede1e5c..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-.section .llvmbc
-.incbin "bcsection.bc"
diff --git a/test/tools/gold/Inputs/comdat.ll b/test/tools/gold/Inputs/comdat.ll
deleted file mode 100644 (file)
index 464aefa..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-$c2 = comdat any
-$c1 = comdat any
-
-; This is only present in this file. The linker will keep $c1 from the first
-; file and this will be undefined.
-@will_be_undefined = global i32 1, comdat($c1)
-
-@v1 = weak_odr global i32 41, comdat($c2)
-define weak_odr protected i32 @f1(i8* %this) comdat($c2) {
-bb20:
-  store i8* %this, i8** null
-  br label %bb21
-bb21:
-  ret i32 41
-}
-
-@r21 = global i32* @v1
-@r22 = global i32(i8*)* @f1
-
-@a21 = alias i32* @v1
-@a22 = alias bitcast (i32* @v1 to i16*)
-
-@a23 = alias i32(i8*)* @f1
-@a24 = alias bitcast (i32(i8*)* @f1 to i16*)
-@a25 = alias i16* @a24
diff --git a/test/tools/gold/Inputs/common.ll b/test/tools/gold/Inputs/common.ll
deleted file mode 100644 (file)
index 46f199e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-@a = common global i16 0, align 4
diff --git a/test/tools/gold/Inputs/drop-debug.bc b/test/tools/gold/Inputs/drop-debug.bc
deleted file mode 100644 (file)
index f9c471f..0000000
Binary files a/test/tools/gold/Inputs/drop-debug.bc and /dev/null differ
diff --git a/test/tools/gold/Inputs/invalid.bc b/test/tools/gold/Inputs/invalid.bc
deleted file mode 100644 (file)
index 2e7ca8d..0000000
Binary files a/test/tools/gold/Inputs/invalid.bc and /dev/null differ
diff --git a/test/tools/gold/Inputs/linker-script.export b/test/tools/gold/Inputs/linker-script.export
deleted file mode 100644 (file)
index 2062a08..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-{
-  global:
-    f;
-  local: *;
-};
diff --git a/test/tools/gold/Inputs/linkonce-weak.ll b/test/tools/gold/Inputs/linkonce-weak.ll
deleted file mode 100644 (file)
index f42af8f..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-define weak_odr void @f() {
-  ret void
-}
diff --git a/test/tools/gold/Inputs/pr19901-1.ll b/test/tools/gold/Inputs/pr19901-1.ll
deleted file mode 100644 (file)
index 2f71532..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-target triple = "x86_64-unknown-linux-gnu"
-define linkonce_odr hidden void @f() {
-  ret void
-}
diff --git a/test/tools/gold/Inputs/weak.ll b/test/tools/gold/Inputs/weak.ll
deleted file mode 100644 (file)
index 53b1d16..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-@a = weak global i32 41
-@c = global i32* @a
diff --git a/test/tools/gold/PowerPC/lit.local.cfg b/test/tools/gold/PowerPC/lit.local.cfg
new file mode 100644 (file)
index 0000000..d968938
--- /dev/null
@@ -0,0 +1,3 @@
+if (not 'ld_plugin' in  config.available_features or
+    not 'PowerPC' in config.root.targets):
+   config.unsupported = True
diff --git a/test/tools/gold/PowerPC/mtriple.ll b/test/tools/gold/PowerPC/mtriple.ll
new file mode 100644 (file)
index 0000000..87b2260
--- /dev/null
@@ -0,0 +1,15 @@
+; REQUIRES: ld_emu_elf32ppc
+
+; RUN: llvm-as %s -o %t.o
+; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so -m elf32ppc \
+; RUN:    -plugin-opt=mtriple=powerpc-linux-gnu \
+; RUN:    -plugin-opt=obj-path=%t3.o \
+; RUN:    -shared %t.o -o %t2
+; RUN: llvm-readobj --file-headers %t2 | FileCheck  --check-prefix=DSO %s
+; RUN: llvm-readobj --file-headers %t3.o | FileCheck --check-prefix=REL %s
+
+; REL:       Type: Relocatable
+; REL-NEXT:  Machine: EM_PPC
+
+; DSO:       Type: SharedObject
+; DSO-NEXT:  Machine: EM_PPC
diff --git a/test/tools/gold/X86/Inputs/alias-1.ll b/test/tools/gold/X86/Inputs/alias-1.ll
new file mode 100644 (file)
index 0000000..96183aa
--- /dev/null
@@ -0,0 +1 @@
+@a = global i32 42
diff --git a/test/tools/gold/X86/Inputs/bcsection.s b/test/tools/gold/X86/Inputs/bcsection.s
new file mode 100644 (file)
index 0000000..ede1e5c
--- /dev/null
@@ -0,0 +1,2 @@
+.section .llvmbc
+.incbin "bcsection.bc"
diff --git a/test/tools/gold/X86/Inputs/comdat.ll b/test/tools/gold/X86/Inputs/comdat.ll
new file mode 100644 (file)
index 0000000..464aefa
--- /dev/null
@@ -0,0 +1,25 @@
+$c2 = comdat any
+$c1 = comdat any
+
+; This is only present in this file. The linker will keep $c1 from the first
+; file and this will be undefined.
+@will_be_undefined = global i32 1, comdat($c1)
+
+@v1 = weak_odr global i32 41, comdat($c2)
+define weak_odr protected i32 @f1(i8* %this) comdat($c2) {
+bb20:
+  store i8* %this, i8** null
+  br label %bb21
+bb21:
+  ret i32 41
+}
+
+@r21 = global i32* @v1
+@r22 = global i32(i8*)* @f1
+
+@a21 = alias i32* @v1
+@a22 = alias bitcast (i32* @v1 to i16*)
+
+@a23 = alias i32(i8*)* @f1
+@a24 = alias bitcast (i32(i8*)* @f1 to i16*)
+@a25 = alias i16* @a24
diff --git a/test/tools/gold/X86/Inputs/common.ll b/test/tools/gold/X86/Inputs/common.ll
new file mode 100644 (file)
index 0000000..46f199e
--- /dev/null
@@ -0,0 +1 @@
+@a = common global i16 0, align 4
diff --git a/test/tools/gold/X86/Inputs/drop-debug.bc b/test/tools/gold/X86/Inputs/drop-debug.bc
new file mode 100644 (file)
index 0000000..f9c471f
Binary files /dev/null and b/test/tools/gold/X86/Inputs/drop-debug.bc differ
diff --git a/test/tools/gold/X86/Inputs/invalid.bc b/test/tools/gold/X86/Inputs/invalid.bc
new file mode 100644 (file)
index 0000000..2e7ca8d
Binary files /dev/null and b/test/tools/gold/X86/Inputs/invalid.bc differ
diff --git a/test/tools/gold/X86/Inputs/linker-script.export b/test/tools/gold/X86/Inputs/linker-script.export
new file mode 100644 (file)
index 0000000..2062a08
--- /dev/null
@@ -0,0 +1,5 @@
+{
+  global:
+    f;
+  local: *;
+};
diff --git a/test/tools/gold/X86/Inputs/linkonce-weak.ll b/test/tools/gold/X86/Inputs/linkonce-weak.ll
new file mode 100644 (file)
index 0000000..f42af8f
--- /dev/null
@@ -0,0 +1,3 @@
+define weak_odr void @f() {
+  ret void
+}
diff --git a/test/tools/gold/X86/Inputs/pr19901-1.ll b/test/tools/gold/X86/Inputs/pr19901-1.ll
new file mode 100644 (file)
index 0000000..2f71532
--- /dev/null
@@ -0,0 +1,4 @@
+target triple = "x86_64-unknown-linux-gnu"
+define linkonce_odr hidden void @f() {
+  ret void
+}
diff --git a/test/tools/gold/X86/Inputs/weak.ll b/test/tools/gold/X86/Inputs/weak.ll
new file mode 100644 (file)
index 0000000..53b1d16
--- /dev/null
@@ -0,0 +1,2 @@
+@a = weak global i32 41
+@c = global i32* @a
diff --git a/test/tools/gold/X86/alias.ll b/test/tools/gold/X86/alias.ll
new file mode 100644 (file)
index 0000000..b4edb05
--- /dev/null
@@ -0,0 +1,13 @@
+; RUN: llvm-as %s -o %t.o
+; RUN: llvm-as %p/Inputs/alias-1.ll -o %t2.o
+; RUN: %gold -shared -o %t3.o -plugin %llvmshlibdir/LLVMgold.so %t2.o %t.o \
+; RUN:  -plugin-opt=emit-llvm
+; RUN: llvm-dis < %t3.o -o - | FileCheck %s
+
+; CHECK-NOT: alias
+; CHECK: @a = global i32 42
+; CHECK-NEXT: @b = global i32 1
+; CHECK-NOT: alias
+
+@a = weak alias i32* @b
+@b = global i32 1
diff --git a/test/tools/gold/X86/bad-alias.ll b/test/tools/gold/X86/bad-alias.ll
new file mode 100644 (file)
index 0000000..a98bf71
--- /dev/null
@@ -0,0 +1,13 @@
+; RUN: llvm-as %s -o %t.o
+
+; RUN: not %gold -plugin %llvmshlibdir/LLVMgold.so \
+; RUN:    --plugin-opt=emit-llvm \
+; RUN:    -shared %t.o -o %t2.o 2>&1 | FileCheck %s
+
+; CHECK: Unable to determine comdat of alias!
+
+@g1 = global i32 1
+@g2 = global i32 2
+
+@a = alias inttoptr(i32 sub (i32 ptrtoint (i32* @g1 to i32),
+                             i32 ptrtoint (i32* @g2 to i32)) to i32*)
diff --git a/test/tools/gold/X86/bcsection.ll b/test/tools/gold/X86/bcsection.ll
new file mode 100644 (file)
index 0000000..37d2994
--- /dev/null
@@ -0,0 +1,11 @@
+; RUN: llvm-as -o %T/bcsection.bc %s
+
+; RUN: llvm-mc -I=%T -filetype=obj -o %T/bcsection.bco %p/Inputs/bcsection.s
+; RUN: llvm-nm -no-llvm-bc %T/bcsection.bco | count 0
+; RUN: %gold -r -o %T/bcsection.o -plugin %llvmshlibdir/LLVMgold.so %T/bcsection.bco
+; RUN: llvm-nm -no-llvm-bc %T/bcsection.o | FileCheck %s
+
+; CHECK: main
+define i32 @main() {
+  ret i32 0
+}
diff --git a/test/tools/gold/X86/coff.ll b/test/tools/gold/X86/coff.ll
new file mode 100644 (file)
index 0000000..5d8a1c9
--- /dev/null
@@ -0,0 +1,22 @@
+; RUN: llvm-as %s -o %t.o
+; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so -plugin-opt=emit-llvm \
+; RUN:    -shared %t.o -o %t2.o
+; RUN: llvm-dis %t2.o -o - | FileCheck %s
+
+
+target datalayout = "m:w"
+
+; CHECK: define void @f() {
+define void @f() {
+  ret void
+}
+
+; CHECK: define internal void @g() {
+define hidden void @g() {
+  ret void
+}
+
+; CHECK: define internal void @h() {
+define linkonce_odr void @h() {
+  ret void
+}
diff --git a/test/tools/gold/X86/comdat.ll b/test/tools/gold/X86/comdat.ll
new file mode 100644 (file)
index 0000000..370bf56
--- /dev/null
@@ -0,0 +1,65 @@
+; RUN: llvm-as %s -o %t.o
+; RUN: llvm-as %p/Inputs/comdat.ll -o %t2.o
+; RUN: %gold -shared -o %t3.o -plugin %llvmshlibdir/LLVMgold.so %t.o %t2.o \
+; RUN:  -plugin-opt=emit-llvm
+; RUN: llvm-dis %t3.o -o - | FileCheck %s
+
+$c1 = comdat any
+
+@v1 = weak_odr global i32 42, comdat($c1)
+define weak_odr i32 @f1(i8*) comdat($c1) {
+bb10:
+  br label %bb11
+bb11:
+  ret i32 42
+}
+
+@r11 = global i32* @v1
+@r12 = global i32 (i8*)* @f1
+
+@a11 = alias i32* @v1
+@a12 = alias bitcast (i32* @v1 to i16*)
+
+@a13 = alias i32 (i8*)* @f1
+@a14 = alias bitcast (i32 (i8*)* @f1 to i16*)
+@a15 = alias i16* @a14
+
+; CHECK: $c1 = comdat any
+; CHECK: $c2 = comdat any
+
+; CHECK: @v1 = weak_odr global i32 42, comdat($c1)
+
+; CHECK: @r11 = global i32* @v1{{$}}
+; CHECK: @r12 = global i32 (i8*)* @f1{{$}}
+
+; CHECK: @r21 = global i32* @v1{{$}}
+; CHECK: @r22 = global i32 (i8*)* @f1{{$}}
+
+; CHECK: @v11 = internal global i32 41, comdat($c2)
+
+; CHECK: @a11 = alias i32* @v1{{$}}
+; CHECK: @a12 = alias bitcast (i32* @v1 to i16*)
+
+; CHECK: @a13 = alias i32 (i8*)* @f1{{$}}
+; CHECK: @a14 = alias bitcast (i32 (i8*)* @f1 to i16*)
+
+; CHECK: @a21 = alias i32* @v11{{$}}
+; CHECK: @a22 = alias bitcast (i32* @v11 to i16*)
+
+; CHECK: @a23 = alias i32 (i8*)* @f12{{$}}
+; CHECK: @a24 = alias bitcast (i32 (i8*)* @f12 to i16*)
+
+; CHECK:      define weak_odr protected i32 @f1(i8*) comdat($c1) {
+; CHECK-NEXT: bb10:
+; CHECK-NEXT:   br label %bb11{{$}}
+; CHECK:      bb11:
+; CHECK-NEXT:   ret i32 42
+; CHECK-NEXT: }
+
+; CHECK:      define internal i32 @f12(i8* %this) comdat($c2) {
+; CHECK-NEXT: bb20:
+; CHECK-NEXT:   store i8* %this, i8** null
+; CHECK-NEXT:   br label %bb21
+; CHECK:      bb21:
+; CHECK-NEXT:   ret i32 41
+; CHECK-NEXT: }
diff --git a/test/tools/gold/X86/common.ll b/test/tools/gold/X86/common.ll
new file mode 100644 (file)
index 0000000..ef18e68
--- /dev/null
@@ -0,0 +1,29 @@
+; RUN: llvm-as %s -o %t1.o
+; RUN: llvm-as %p/Inputs/common.ll -o %t2.o
+
+; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
+; RUN:    --plugin-opt=emit-llvm \
+; RUN:    -shared %t1.o %t2.o -o %t3.o
+; RUN: llvm-dis %t3.o -o - | FileCheck %s
+
+@a = common global i8 0, align 8
+
+; Shared library case, we merge @a as common and keep it for the symbol table.
+; CHECK: @a = common global i16 0, align 8
+
+; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
+; RUN:    --plugin-opt=emit-llvm \
+; RUN:    %t1.o %t2.o -o %t3.o
+; RUN: llvm-dis %t3.o -o - | FileCheck --check-prefix=EXEC %s
+
+; All IR case, we internalize a after merging.
+; EXEC: @a = internal global i16 0, align 8
+
+; RUN: llc %p/Inputs/common.ll -o %t2.o -filetype=obj
+; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
+; RUN:    --plugin-opt=emit-llvm \
+; RUN:    %t1.o %t2.o -o %t3.o
+; RUN: llvm-dis %t3.o -o - | FileCheck --check-prefix=MIXED %s
+
+; Mixed ELF and IR. We keep ours as common so the linker will finish the merge.
+; MIXED: @a = common global i8 0, align 8
diff --git a/test/tools/gold/X86/drop-debug.ll b/test/tools/gold/X86/drop-debug.ll
new file mode 100644 (file)
index 0000000..b8c4d8c
--- /dev/null
@@ -0,0 +1,8 @@
+; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
+; RUN:    --plugin-opt=emit-llvm -shared %p/Inputs/drop-debug.bc \
+; RUN:    -o t2.bc 2>&1 | FileCheck %s
+
+; drop-debug.bc was created from "void f(void) {}" with clang 3.5 and
+; -gline-tables-only, so it contains old debug info.
+
+; CHECK: warning: LLVM gold plugin: ignoring debug info with an invalid version (1) in {{.*}}/Inputs/drop-debug.bc
diff --git a/test/tools/gold/X86/emit-llvm.ll b/test/tools/gold/X86/emit-llvm.ll
new file mode 100644 (file)
index 0000000..bfb90c4
--- /dev/null
@@ -0,0 +1,92 @@
+; RUN: llvm-as %s -o %t.o
+
+; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
+; RUN:    --plugin-opt=emit-llvm \
+; RUN:    --plugin-opt=generate-api-file \
+; RUN:    -shared %t.o -o %t2.o
+; RUN: llvm-dis %t2.o -o - | FileCheck %s
+; RUN: FileCheck --check-prefix=API %s < %T/../apifile.txt
+
+; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
+; RUN:     -m elf_x86_64 --plugin-opt=save-temps \
+; RUN:    -shared %t.o -o %t3.o
+; RUN: llvm-dis %t3.o.bc -o - | FileCheck %s
+; RUN: llvm-dis %t3.o.opt.bc -o - | FileCheck --check-prefix=OPT %s
+; RUN: llvm-nm %t3.o.o | FileCheck --check-prefix=NM %s
+
+; RUN: rm -f %t4.o
+; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
+; RUN:     -m elf_x86_64 --plugin-opt=disable-output \
+; RUN:    -shared %t.o -o %t4.o
+; RUN: not test -a %t4.o
+
+; NM: T f3
+
+target triple = "x86_64-unknown-linux-gnu"
+
+@g7 = extern_weak global i32
+; CHECK-DAG: @g7 = extern_weak global i32
+
+@g8 = external global i32
+
+; CHECK: define internal void @f1()
+; OPT-NOT: @f1
+define hidden void @f1() {
+  ret void
+}
+
+; CHECK: define hidden void @f2()
+; OPT: define hidden void @f2()
+define hidden void @f2() {
+  ret void
+}
+
+@llvm.used = appending global [1 x i8*] [ i8* bitcast (void ()* @f2 to i8*)]
+
+; CHECK: define void @f3()
+; OPT: define void @f3()
+define void @f3() {
+  call void @f4()
+  ret void
+}
+
+; CHECK: define internal void @f4()
+; OPT-NOT: @f4
+define linkonce_odr void @f4() {
+  ret void
+}
+
+; CHECK: define linkonce_odr void @f5()
+; OPT: define linkonce_odr void @f5()
+define linkonce_odr void @f5() {
+  ret void
+}
+@g5 = global void()* @f5
+
+; CHECK: define internal void @f6() unnamed_addr
+; OPT: define internal void @f6() unnamed_addr
+define linkonce_odr void @f6() unnamed_addr {
+  ret void
+}
+@g6 = global void()* @f6
+
+define i32* @f7() {
+  ret i32* @g7
+}
+
+define i32* @f8() {
+  ret i32* @g8
+}
+
+; API: f1 PREVAILING_DEF_IRONLY
+; API: f2 PREVAILING_DEF_IRONLY
+; API: f3 PREVAILING_DEF_IRONLY_EXP
+; API: f4 PREVAILING_DEF_IRONLY_EXP
+; API: f5 PREVAILING_DEF_IRONLY_EXP
+; API: f6 PREVAILING_DEF_IRONLY_EXP
+; API: f7 PREVAILING_DEF_IRONLY_EXP
+; API: f8 PREVAILING_DEF_IRONLY_EXP
+; API: g7 UNDEF
+; API: g8 UNDEF
+; API: g5 PREVAILING_DEF_IRONLY_EXP
+; API: g6 PREVAILING_DEF_IRONLY_EXP
diff --git a/test/tools/gold/X86/invalid.ll b/test/tools/gold/X86/invalid.ll
new file mode 100644 (file)
index 0000000..858cd47
--- /dev/null
@@ -0,0 +1,7 @@
+; RUN: not %gold -plugin %llvmshlibdir/LLVMgold.so \
+; RUN:    %p/Inputs/invalid.bc -o %t2 2>&1 | FileCheck %s
+
+; test that only one error gets printed
+
+; CHECK: error: LLVM gold plugin has failed to create LTO module: Malformed block
+; CHECK-NOT: error
diff --git a/test/tools/gold/X86/linker-script.ll b/test/tools/gold/X86/linker-script.ll
new file mode 100644 (file)
index 0000000..7c88b0f
--- /dev/null
@@ -0,0 +1,17 @@
+; RUN: llvm-as %s -o %t.o
+
+; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
+; RUN:    --plugin-opt=emit-llvm \
+; RUN:    -shared %t.o -o %t2.o \
+; RUN:    -version-script=%p/Inputs/linker-script.export
+; RUN: llvm-dis %t2.o -o - | FileCheck %s
+
+; CHECK: define void @f()
+define void @f() {
+  ret void
+}
+
+; CHECK: define internal void @g()
+define void @g() {
+  ret void
+}
diff --git a/test/tools/gold/X86/linkonce-weak.ll b/test/tools/gold/X86/linkonce-weak.ll
new file mode 100644 (file)
index 0000000..a0cccea
--- /dev/null
@@ -0,0 +1,19 @@
+; RUN: llvm-as %s -o %t.o
+; RUN: llvm-as %p/Inputs/linkonce-weak.ll -o %t2.o
+
+; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
+; RUN:    --plugin-opt=emit-llvm \
+; RUN:    -shared %t.o %t2.o -o %t3.o
+; RUN: llvm-dis %t3.o -o - | FileCheck %s
+
+; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
+; RUN:    --plugin-opt=emit-llvm \
+; RUN:    -shared %t2.o %t.o -o %t3.o
+; RUN: llvm-dis %t3.o -o - | FileCheck %s
+
+define linkonce_odr void @f() {
+  ret void
+}
+
+; Test that we get a weak_odr regardless of the order of the files
+; CHECK: define weak_odr void @f() {
diff --git a/test/tools/gold/X86/lit.local.cfg b/test/tools/gold/X86/lit.local.cfg
new file mode 100644 (file)
index 0000000..ddcd48c
--- /dev/null
@@ -0,0 +1,3 @@
+if (not 'ld_plugin' in  config.available_features or
+    not 'X86' in config.root.targets):
+   config.unsupported = True
diff --git a/test/tools/gold/X86/no-map-whole-file.ll b/test/tools/gold/X86/no-map-whole-file.ll
new file mode 100644 (file)
index 0000000..4c261d7
--- /dev/null
@@ -0,0 +1,9 @@
+; RUN: llvm-as -o %t.bc %s
+; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so -plugin-opt=emit-llvm \
+; RUN:    --no-map-whole-files -r -o %t2.bc %t.bc
+; RUN: llvm-dis < %t2.bc -o - | FileCheck %s
+
+; CHECK: main
+define i32 @main() {
+  ret i32 0
+}
diff --git a/test/tools/gold/X86/opt-level.ll b/test/tools/gold/X86/opt-level.ll
new file mode 100644 (file)
index 0000000..3deb0af
--- /dev/null
@@ -0,0 +1,50 @@
+; RUN: llvm-as -o %t.bc %s
+; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so -plugin-opt=save-temps \
+; RUN:    -plugin-opt=O0 -r -o %t.o %t.bc
+; RUN: llvm-dis < %t.o.opt.bc -o - | FileCheck --check-prefix=CHECK-O0 %s
+; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so -plugin-opt=save-temps \
+; RUN:    -plugin-opt=O1 -r -o %t.o %t.bc
+; RUN: llvm-dis < %t.o.opt.bc -o - | FileCheck --check-prefix=CHECK-O1 %s
+; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so -plugin-opt=save-temps \
+; RUN:    -plugin-opt=O2 -r -o %t.o %t.bc
+; RUN: llvm-dis < %t.o.opt.bc -o - | FileCheck --check-prefix=CHECK-O2 %s
+
+; CHECK-O0: define internal void @foo(
+; CHECK-O1: define internal void @foo(
+; CHECK-O2-NOT: define internal void @foo(
+define internal void @foo() {
+  ret void
+}
+
+; CHECK-O0: define internal i32 @bar(
+; CHECK-O1: define internal i32 @bar(
+define internal i32 @bar(i1 %p) {
+  br i1 %p, label %t, label %f
+
+t:
+  br label %end
+
+f:
+  br label %end
+
+end:
+  ; CHECK-O0: phi
+  ; CHECK-O1: select
+  %r = phi i32 [ 1, %t ], [ 2, %f ]
+  ret i32 %r
+}
+
+define void @baz() {
+  call void @foo()
+  %c = call i32 @bar(i1 true)
+  ret void
+}
+
+@a = constant i32 1
+
+!0 = !{!"bitset1", i32* @a, i32 0}
+
+; CHECK-O0-NOT: llvm.bitsets
+; CHECK-O1-NOT: llvm.bitsets
+; CHECK-O2-NOT: llvm.bitsets
+!llvm.bitsets = !{ !0 }
diff --git a/test/tools/gold/X86/pr19901.ll b/test/tools/gold/X86/pr19901.ll
new file mode 100644 (file)
index 0000000..71bb134
--- /dev/null
@@ -0,0 +1,24 @@
+; RUN: llc %s -o %t.o -filetype=obj -relocation-model=pic
+; RUN: llvm-as %p/Inputs/pr19901-1.ll -o %t2.o
+; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
+; RUN:     -shared -m elf_x86_64 -o %t.so %t2.o %t.o
+; RUN: llvm-readobj -t %t.so | FileCheck %s
+
+; CHECK:       Symbol {
+; CHECK:         Name: f
+; CHECK-NEXT:    Value:
+; CHECK-NEXT:    Size:
+; CHECK-NEXT:    Binding: Local
+; CHECK-NEXT:    Type: Function
+; CHECK-NEXT:    Other: {{2|0}}
+; CHECK-NEXT:    Section: .text
+; CHECK-NEXT:  }
+
+target triple = "x86_64-unknown-linux-gnu"
+define i32 @g() {
+  call void @f()
+  ret i32 0
+}
+define linkonce_odr hidden void @f() {
+  ret void
+}
diff --git a/test/tools/gold/X86/remarks.ll b/test/tools/gold/X86/remarks.ll
new file mode 100644 (file)
index 0000000..c4fa7f7
--- /dev/null
@@ -0,0 +1,22 @@
+; RUN: llvm-as %s -o %t.o
+
+; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold.so \
+; RUN:    -plugin-opt=-pass-remarks=inline %t.o -o %t2.o 2>&1 | FileCheck %s
+
+; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold.so \
+; RUN:   %t.o -o %t2.o 2>&1 | FileCheck -allow-empty --check-prefix=NO-REMARK %s
+
+
+; CHECK: f inlined into _start
+; NO-REMARK-NOT: inlined
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+define i32 @f() {
+  ret i32 0
+}
+
+define i32 @_start() {
+  %call = call i32 @f()
+  ret i32 %call
+}
diff --git a/test/tools/gold/X86/slp-vectorize.ll b/test/tools/gold/X86/slp-vectorize.ll
new file mode 100644 (file)
index 0000000..30950b2
--- /dev/null
@@ -0,0 +1,30 @@
+; RUN: llvm-as %s -o %t.o
+
+; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold.so \
+; RUN:    --plugin-opt=save-temps \
+; RUN:    -shared %t.o -o %t2.o
+; RUN: llvm-dis %t2.o.opt.bc -o - | FileCheck %s
+
+; test that the vectorizer is run.
+; CHECK: fadd <4 x float>
+
+target triple = "x86_64-unknown-linux-gnu"
+
+define void @f(float* nocapture %x) {
+  %tmp = load float, float* %x, align 4
+  %add = fadd float %tmp, 1.000000e+00
+  store float %add, float* %x, align 4
+  %arrayidx1 = getelementptr inbounds float, float* %x, i64 1
+  %tmp1 = load float, float* %arrayidx1, align 4
+  %add2 = fadd float %tmp1, 1.000000e+00
+  store float %add2, float* %arrayidx1, align 4
+  %arrayidx3 = getelementptr inbounds float, float* %x, i64 2
+  %tmp2 = load float, float* %arrayidx3, align 4
+  %add4 = fadd float %tmp2, 1.000000e+00
+  store float %add4, float* %arrayidx3, align 4
+  %arrayidx5 = getelementptr inbounds float, float* %x, i64 3
+  %tmp3 = load float, float* %arrayidx5, align 4
+  %add6 = fadd float %tmp3, 1.000000e+00
+  store float %add6, float* %arrayidx5, align 4
+  ret void
+}
diff --git a/test/tools/gold/X86/stats.ll b/test/tools/gold/X86/stats.ll
new file mode 100644 (file)
index 0000000..b3c8297
--- /dev/null
@@ -0,0 +1,7 @@
+; REQUIRES: asserts
+
+; RUN: llvm-as %s -o %t.o
+; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so  -shared \
+; RUN:    -plugin-opt=-stats %t.o -o %t2 2>&1 | FileCheck %s
+
+; CHECK: Statistics Collected
diff --git a/test/tools/gold/X86/vectorize.ll b/test/tools/gold/X86/vectorize.ll
new file mode 100644 (file)
index 0000000..5f003dd
--- /dev/null
@@ -0,0 +1,30 @@
+; RUN: llvm-as %s -o %t.o
+
+; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold.so \
+; RUN:    --plugin-opt=save-temps \
+; RUN:    -shared %t.o -o %t2.o
+; RUN: llvm-dis %t2.o.opt.bc -o - | FileCheck %s
+
+; test that the vectorizer is run.
+; CHECK: fadd <4 x float>
+
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+define void @f(float* nocapture %x, i64 %n) {
+bb:
+  br label %bb1
+
+bb1:
+  %i.0 = phi i64 [ 0, %bb ], [ %tmp4, %bb1 ]
+  %tmp = getelementptr inbounds float, float* %x, i64 %i.0
+  %tmp2 = load float, float* %tmp, align 4
+  %tmp3 = fadd float %tmp2, 1.000000e+00
+  store float %tmp3, float* %tmp, align 4
+  %tmp4 = add nsw i64 %i.0, 1
+  %tmp5 = icmp slt i64 %tmp4, %n
+  br i1 %tmp5, label %bb1, label %bb6
+
+bb6:
+  ret void
+}
diff --git a/test/tools/gold/X86/weak.ll b/test/tools/gold/X86/weak.ll
new file mode 100644 (file)
index 0000000..6d8d7a8
--- /dev/null
@@ -0,0 +1,16 @@
+; RUN: llvm-as %s -o %t.o
+; RUN: llvm-as %p/Inputs/weak.ll -o %t2.o
+
+; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
+; RUN:    --plugin-opt=emit-llvm \
+; RUN:    -shared %t.o %t2.o -o %t3.o
+; RUN: llvm-dis %t3.o -o - | FileCheck %s
+
+@a = weak global i32 42
+@b = global i32* @a
+
+; Test that @b and @c end up pointing to the same variable.
+
+; CHECK: @a = weak global i32 42
+; CHECK: @b = global i32* @a{{$}}
+; CHECK: @c = global i32* @a{{$}}
diff --git a/test/tools/gold/alias.ll b/test/tools/gold/alias.ll
deleted file mode 100644 (file)
index b4edb05..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-; RUN: llvm-as %s -o %t.o
-; RUN: llvm-as %p/Inputs/alias-1.ll -o %t2.o
-; RUN: %gold -shared -o %t3.o -plugin %llvmshlibdir/LLVMgold.so %t2.o %t.o \
-; RUN:  -plugin-opt=emit-llvm
-; RUN: llvm-dis < %t3.o -o - | FileCheck %s
-
-; CHECK-NOT: alias
-; CHECK: @a = global i32 42
-; CHECK-NEXT: @b = global i32 1
-; CHECK-NOT: alias
-
-@a = weak alias i32* @b
-@b = global i32 1
diff --git a/test/tools/gold/bad-alias.ll b/test/tools/gold/bad-alias.ll
deleted file mode 100644 (file)
index a98bf71..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-; RUN: llvm-as %s -o %t.o
-
-; RUN: not %gold -plugin %llvmshlibdir/LLVMgold.so \
-; RUN:    --plugin-opt=emit-llvm \
-; RUN:    -shared %t.o -o %t2.o 2>&1 | FileCheck %s
-
-; CHECK: Unable to determine comdat of alias!
-
-@g1 = global i32 1
-@g2 = global i32 2
-
-@a = alias inttoptr(i32 sub (i32 ptrtoint (i32* @g1 to i32),
-                             i32 ptrtoint (i32* @g2 to i32)) to i32*)
diff --git a/test/tools/gold/bcsection.ll b/test/tools/gold/bcsection.ll
deleted file mode 100644 (file)
index 37d2994..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-; RUN: llvm-as -o %T/bcsection.bc %s
-
-; RUN: llvm-mc -I=%T -filetype=obj -o %T/bcsection.bco %p/Inputs/bcsection.s
-; RUN: llvm-nm -no-llvm-bc %T/bcsection.bco | count 0
-; RUN: %gold -r -o %T/bcsection.o -plugin %llvmshlibdir/LLVMgold.so %T/bcsection.bco
-; RUN: llvm-nm -no-llvm-bc %T/bcsection.o | FileCheck %s
-
-; CHECK: main
-define i32 @main() {
-  ret i32 0
-}
diff --git a/test/tools/gold/coff.ll b/test/tools/gold/coff.ll
deleted file mode 100644 (file)
index 5d8a1c9..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-; RUN: llvm-as %s -o %t.o
-; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so -plugin-opt=emit-llvm \
-; RUN:    -shared %t.o -o %t2.o
-; RUN: llvm-dis %t2.o -o - | FileCheck %s
-
-
-target datalayout = "m:w"
-
-; CHECK: define void @f() {
-define void @f() {
-  ret void
-}
-
-; CHECK: define internal void @g() {
-define hidden void @g() {
-  ret void
-}
-
-; CHECK: define internal void @h() {
-define linkonce_odr void @h() {
-  ret void
-}
diff --git a/test/tools/gold/comdat.ll b/test/tools/gold/comdat.ll
deleted file mode 100644 (file)
index 370bf56..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-; RUN: llvm-as %s -o %t.o
-; RUN: llvm-as %p/Inputs/comdat.ll -o %t2.o
-; RUN: %gold -shared -o %t3.o -plugin %llvmshlibdir/LLVMgold.so %t.o %t2.o \
-; RUN:  -plugin-opt=emit-llvm
-; RUN: llvm-dis %t3.o -o - | FileCheck %s
-
-$c1 = comdat any
-
-@v1 = weak_odr global i32 42, comdat($c1)
-define weak_odr i32 @f1(i8*) comdat($c1) {
-bb10:
-  br label %bb11
-bb11:
-  ret i32 42
-}
-
-@r11 = global i32* @v1
-@r12 = global i32 (i8*)* @f1
-
-@a11 = alias i32* @v1
-@a12 = alias bitcast (i32* @v1 to i16*)
-
-@a13 = alias i32 (i8*)* @f1
-@a14 = alias bitcast (i32 (i8*)* @f1 to i16*)
-@a15 = alias i16* @a14
-
-; CHECK: $c1 = comdat any
-; CHECK: $c2 = comdat any
-
-; CHECK: @v1 = weak_odr global i32 42, comdat($c1)
-
-; CHECK: @r11 = global i32* @v1{{$}}
-; CHECK: @r12 = global i32 (i8*)* @f1{{$}}
-
-; CHECK: @r21 = global i32* @v1{{$}}
-; CHECK: @r22 = global i32 (i8*)* @f1{{$}}
-
-; CHECK: @v11 = internal global i32 41, comdat($c2)
-
-; CHECK: @a11 = alias i32* @v1{{$}}
-; CHECK: @a12 = alias bitcast (i32* @v1 to i16*)
-
-; CHECK: @a13 = alias i32 (i8*)* @f1{{$}}
-; CHECK: @a14 = alias bitcast (i32 (i8*)* @f1 to i16*)
-
-; CHECK: @a21 = alias i32* @v11{{$}}
-; CHECK: @a22 = alias bitcast (i32* @v11 to i16*)
-
-; CHECK: @a23 = alias i32 (i8*)* @f12{{$}}
-; CHECK: @a24 = alias bitcast (i32 (i8*)* @f12 to i16*)
-
-; CHECK:      define weak_odr protected i32 @f1(i8*) comdat($c1) {
-; CHECK-NEXT: bb10:
-; CHECK-NEXT:   br label %bb11{{$}}
-; CHECK:      bb11:
-; CHECK-NEXT:   ret i32 42
-; CHECK-NEXT: }
-
-; CHECK:      define internal i32 @f12(i8* %this) comdat($c2) {
-; CHECK-NEXT: bb20:
-; CHECK-NEXT:   store i8* %this, i8** null
-; CHECK-NEXT:   br label %bb21
-; CHECK:      bb21:
-; CHECK-NEXT:   ret i32 41
-; CHECK-NEXT: }
diff --git a/test/tools/gold/common.ll b/test/tools/gold/common.ll
deleted file mode 100644 (file)
index ef18e68..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-; RUN: llvm-as %s -o %t1.o
-; RUN: llvm-as %p/Inputs/common.ll -o %t2.o
-
-; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
-; RUN:    --plugin-opt=emit-llvm \
-; RUN:    -shared %t1.o %t2.o -o %t3.o
-; RUN: llvm-dis %t3.o -o - | FileCheck %s
-
-@a = common global i8 0, align 8
-
-; Shared library case, we merge @a as common and keep it for the symbol table.
-; CHECK: @a = common global i16 0, align 8
-
-; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
-; RUN:    --plugin-opt=emit-llvm \
-; RUN:    %t1.o %t2.o -o %t3.o
-; RUN: llvm-dis %t3.o -o - | FileCheck --check-prefix=EXEC %s
-
-; All IR case, we internalize a after merging.
-; EXEC: @a = internal global i16 0, align 8
-
-; RUN: llc %p/Inputs/common.ll -o %t2.o -filetype=obj
-; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
-; RUN:    --plugin-opt=emit-llvm \
-; RUN:    %t1.o %t2.o -o %t3.o
-; RUN: llvm-dis %t3.o -o - | FileCheck --check-prefix=MIXED %s
-
-; Mixed ELF and IR. We keep ours as common so the linker will finish the merge.
-; MIXED: @a = common global i8 0, align 8
diff --git a/test/tools/gold/drop-debug.ll b/test/tools/gold/drop-debug.ll
deleted file mode 100644 (file)
index b8c4d8c..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
-; RUN:    --plugin-opt=emit-llvm -shared %p/Inputs/drop-debug.bc \
-; RUN:    -o t2.bc 2>&1 | FileCheck %s
-
-; drop-debug.bc was created from "void f(void) {}" with clang 3.5 and
-; -gline-tables-only, so it contains old debug info.
-
-; CHECK: warning: LLVM gold plugin: ignoring debug info with an invalid version (1) in {{.*}}/Inputs/drop-debug.bc
diff --git a/test/tools/gold/emit-llvm.ll b/test/tools/gold/emit-llvm.ll
deleted file mode 100644 (file)
index bfb90c4..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-; RUN: llvm-as %s -o %t.o
-
-; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
-; RUN:    --plugin-opt=emit-llvm \
-; RUN:    --plugin-opt=generate-api-file \
-; RUN:    -shared %t.o -o %t2.o
-; RUN: llvm-dis %t2.o -o - | FileCheck %s
-; RUN: FileCheck --check-prefix=API %s < %T/../apifile.txt
-
-; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
-; RUN:     -m elf_x86_64 --plugin-opt=save-temps \
-; RUN:    -shared %t.o -o %t3.o
-; RUN: llvm-dis %t3.o.bc -o - | FileCheck %s
-; RUN: llvm-dis %t3.o.opt.bc -o - | FileCheck --check-prefix=OPT %s
-; RUN: llvm-nm %t3.o.o | FileCheck --check-prefix=NM %s
-
-; RUN: rm -f %t4.o
-; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
-; RUN:     -m elf_x86_64 --plugin-opt=disable-output \
-; RUN:    -shared %t.o -o %t4.o
-; RUN: not test -a %t4.o
-
-; NM: T f3
-
-target triple = "x86_64-unknown-linux-gnu"
-
-@g7 = extern_weak global i32
-; CHECK-DAG: @g7 = extern_weak global i32
-
-@g8 = external global i32
-
-; CHECK: define internal void @f1()
-; OPT-NOT: @f1
-define hidden void @f1() {
-  ret void
-}
-
-; CHECK: define hidden void @f2()
-; OPT: define hidden void @f2()
-define hidden void @f2() {
-  ret void
-}
-
-@llvm.used = appending global [1 x i8*] [ i8* bitcast (void ()* @f2 to i8*)]
-
-; CHECK: define void @f3()
-; OPT: define void @f3()
-define void @f3() {
-  call void @f4()
-  ret void
-}
-
-; CHECK: define internal void @f4()
-; OPT-NOT: @f4
-define linkonce_odr void @f4() {
-  ret void
-}
-
-; CHECK: define linkonce_odr void @f5()
-; OPT: define linkonce_odr void @f5()
-define linkonce_odr void @f5() {
-  ret void
-}
-@g5 = global void()* @f5
-
-; CHECK: define internal void @f6() unnamed_addr
-; OPT: define internal void @f6() unnamed_addr
-define linkonce_odr void @f6() unnamed_addr {
-  ret void
-}
-@g6 = global void()* @f6
-
-define i32* @f7() {
-  ret i32* @g7
-}
-
-define i32* @f8() {
-  ret i32* @g8
-}
-
-; API: f1 PREVAILING_DEF_IRONLY
-; API: f2 PREVAILING_DEF_IRONLY
-; API: f3 PREVAILING_DEF_IRONLY_EXP
-; API: f4 PREVAILING_DEF_IRONLY_EXP
-; API: f5 PREVAILING_DEF_IRONLY_EXP
-; API: f6 PREVAILING_DEF_IRONLY_EXP
-; API: f7 PREVAILING_DEF_IRONLY_EXP
-; API: f8 PREVAILING_DEF_IRONLY_EXP
-; API: g7 UNDEF
-; API: g8 UNDEF
-; API: g5 PREVAILING_DEF_IRONLY_EXP
-; API: g6 PREVAILING_DEF_IRONLY_EXP
diff --git a/test/tools/gold/invalid.ll b/test/tools/gold/invalid.ll
deleted file mode 100644 (file)
index 858cd47..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-; RUN: not %gold -plugin %llvmshlibdir/LLVMgold.so \
-; RUN:    %p/Inputs/invalid.bc -o %t2 2>&1 | FileCheck %s
-
-; test that only one error gets printed
-
-; CHECK: error: LLVM gold plugin has failed to create LTO module: Malformed block
-; CHECK-NOT: error
diff --git a/test/tools/gold/linker-script.ll b/test/tools/gold/linker-script.ll
deleted file mode 100644 (file)
index 7c88b0f..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-; RUN: llvm-as %s -o %t.o
-
-; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
-; RUN:    --plugin-opt=emit-llvm \
-; RUN:    -shared %t.o -o %t2.o \
-; RUN:    -version-script=%p/Inputs/linker-script.export
-; RUN: llvm-dis %t2.o -o - | FileCheck %s
-
-; CHECK: define void @f()
-define void @f() {
-  ret void
-}
-
-; CHECK: define internal void @g()
-define void @g() {
-  ret void
-}
diff --git a/test/tools/gold/linkonce-weak.ll b/test/tools/gold/linkonce-weak.ll
deleted file mode 100644 (file)
index a0cccea..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-; RUN: llvm-as %s -o %t.o
-; RUN: llvm-as %p/Inputs/linkonce-weak.ll -o %t2.o
-
-; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
-; RUN:    --plugin-opt=emit-llvm \
-; RUN:    -shared %t.o %t2.o -o %t3.o
-; RUN: llvm-dis %t3.o -o - | FileCheck %s
-
-; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
-; RUN:    --plugin-opt=emit-llvm \
-; RUN:    -shared %t2.o %t.o -o %t3.o
-; RUN: llvm-dis %t3.o -o - | FileCheck %s
-
-define linkonce_odr void @f() {
-  ret void
-}
-
-; Test that we get a weak_odr regardless of the order of the files
-; CHECK: define weak_odr void @f() {
diff --git a/test/tools/gold/lit.local.cfg b/test/tools/gold/lit.local.cfg
deleted file mode 100644 (file)
index a59549d..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-if (not 'ld_plugin' in  config.available_features or
-    not 'X86' in config.root.targets or
-    not 'PowerPC' in config.root.targets):
-   config.unsupported = True
diff --git a/test/tools/gold/mtriple.ll b/test/tools/gold/mtriple.ll
deleted file mode 100644 (file)
index 87b2260..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-; REQUIRES: ld_emu_elf32ppc
-
-; RUN: llvm-as %s -o %t.o
-; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so -m elf32ppc \
-; RUN:    -plugin-opt=mtriple=powerpc-linux-gnu \
-; RUN:    -plugin-opt=obj-path=%t3.o \
-; RUN:    -shared %t.o -o %t2
-; RUN: llvm-readobj --file-headers %t2 | FileCheck  --check-prefix=DSO %s
-; RUN: llvm-readobj --file-headers %t3.o | FileCheck --check-prefix=REL %s
-
-; REL:       Type: Relocatable
-; REL-NEXT:  Machine: EM_PPC
-
-; DSO:       Type: SharedObject
-; DSO-NEXT:  Machine: EM_PPC
diff --git a/test/tools/gold/no-map-whole-file.ll b/test/tools/gold/no-map-whole-file.ll
deleted file mode 100644 (file)
index 4c261d7..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-; RUN: llvm-as -o %t.bc %s
-; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so -plugin-opt=emit-llvm \
-; RUN:    --no-map-whole-files -r -o %t2.bc %t.bc
-; RUN: llvm-dis < %t2.bc -o - | FileCheck %s
-
-; CHECK: main
-define i32 @main() {
-  ret i32 0
-}
diff --git a/test/tools/gold/opt-level.ll b/test/tools/gold/opt-level.ll
deleted file mode 100644 (file)
index 3deb0af..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-; RUN: llvm-as -o %t.bc %s
-; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so -plugin-opt=save-temps \
-; RUN:    -plugin-opt=O0 -r -o %t.o %t.bc
-; RUN: llvm-dis < %t.o.opt.bc -o - | FileCheck --check-prefix=CHECK-O0 %s
-; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so -plugin-opt=save-temps \
-; RUN:    -plugin-opt=O1 -r -o %t.o %t.bc
-; RUN: llvm-dis < %t.o.opt.bc -o - | FileCheck --check-prefix=CHECK-O1 %s
-; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so -plugin-opt=save-temps \
-; RUN:    -plugin-opt=O2 -r -o %t.o %t.bc
-; RUN: llvm-dis < %t.o.opt.bc -o - | FileCheck --check-prefix=CHECK-O2 %s
-
-; CHECK-O0: define internal void @foo(
-; CHECK-O1: define internal void @foo(
-; CHECK-O2-NOT: define internal void @foo(
-define internal void @foo() {
-  ret void
-}
-
-; CHECK-O0: define internal i32 @bar(
-; CHECK-O1: define internal i32 @bar(
-define internal i32 @bar(i1 %p) {
-  br i1 %p, label %t, label %f
-
-t:
-  br label %end
-
-f:
-  br label %end
-
-end:
-  ; CHECK-O0: phi
-  ; CHECK-O1: select
-  %r = phi i32 [ 1, %t ], [ 2, %f ]
-  ret i32 %r
-}
-
-define void @baz() {
-  call void @foo()
-  %c = call i32 @bar(i1 true)
-  ret void
-}
-
-@a = constant i32 1
-
-!0 = !{!"bitset1", i32* @a, i32 0}
-
-; CHECK-O0-NOT: llvm.bitsets
-; CHECK-O1-NOT: llvm.bitsets
-; CHECK-O2-NOT: llvm.bitsets
-!llvm.bitsets = !{ !0 }
diff --git a/test/tools/gold/pr19901.ll b/test/tools/gold/pr19901.ll
deleted file mode 100644 (file)
index 71bb134..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-; RUN: llc %s -o %t.o -filetype=obj -relocation-model=pic
-; RUN: llvm-as %p/Inputs/pr19901-1.ll -o %t2.o
-; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
-; RUN:     -shared -m elf_x86_64 -o %t.so %t2.o %t.o
-; RUN: llvm-readobj -t %t.so | FileCheck %s
-
-; CHECK:       Symbol {
-; CHECK:         Name: f
-; CHECK-NEXT:    Value:
-; CHECK-NEXT:    Size:
-; CHECK-NEXT:    Binding: Local
-; CHECK-NEXT:    Type: Function
-; CHECK-NEXT:    Other: {{2|0}}
-; CHECK-NEXT:    Section: .text
-; CHECK-NEXT:  }
-
-target triple = "x86_64-unknown-linux-gnu"
-define i32 @g() {
-  call void @f()
-  ret i32 0
-}
-define linkonce_odr hidden void @f() {
-  ret void
-}
diff --git a/test/tools/gold/remarks.ll b/test/tools/gold/remarks.ll
deleted file mode 100644 (file)
index c4fa7f7..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-; RUN: llvm-as %s -o %t.o
-
-; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold.so \
-; RUN:    -plugin-opt=-pass-remarks=inline %t.o -o %t2.o 2>&1 | FileCheck %s
-
-; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold.so \
-; RUN:   %t.o -o %t2.o 2>&1 | FileCheck -allow-empty --check-prefix=NO-REMARK %s
-
-
-; CHECK: f inlined into _start
-; NO-REMARK-NOT: inlined
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
-target triple = "x86_64-unknown-linux-gnu"
-
-define i32 @f() {
-  ret i32 0
-}
-
-define i32 @_start() {
-  %call = call i32 @f()
-  ret i32 %call
-}
diff --git a/test/tools/gold/slp-vectorize.ll b/test/tools/gold/slp-vectorize.ll
deleted file mode 100644 (file)
index 30950b2..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-; RUN: llvm-as %s -o %t.o
-
-; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold.so \
-; RUN:    --plugin-opt=save-temps \
-; RUN:    -shared %t.o -o %t2.o
-; RUN: llvm-dis %t2.o.opt.bc -o - | FileCheck %s
-
-; test that the vectorizer is run.
-; CHECK: fadd <4 x float>
-
-target triple = "x86_64-unknown-linux-gnu"
-
-define void @f(float* nocapture %x) {
-  %tmp = load float, float* %x, align 4
-  %add = fadd float %tmp, 1.000000e+00
-  store float %add, float* %x, align 4
-  %arrayidx1 = getelementptr inbounds float, float* %x, i64 1
-  %tmp1 = load float, float* %arrayidx1, align 4
-  %add2 = fadd float %tmp1, 1.000000e+00
-  store float %add2, float* %arrayidx1, align 4
-  %arrayidx3 = getelementptr inbounds float, float* %x, i64 2
-  %tmp2 = load float, float* %arrayidx3, align 4
-  %add4 = fadd float %tmp2, 1.000000e+00
-  store float %add4, float* %arrayidx3, align 4
-  %arrayidx5 = getelementptr inbounds float, float* %x, i64 3
-  %tmp3 = load float, float* %arrayidx5, align 4
-  %add6 = fadd float %tmp3, 1.000000e+00
-  store float %add6, float* %arrayidx5, align 4
-  ret void
-}
diff --git a/test/tools/gold/stats.ll b/test/tools/gold/stats.ll
deleted file mode 100644 (file)
index b3c8297..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-; REQUIRES: asserts
-
-; RUN: llvm-as %s -o %t.o
-; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so  -shared \
-; RUN:    -plugin-opt=-stats %t.o -o %t2 2>&1 | FileCheck %s
-
-; CHECK: Statistics Collected
diff --git a/test/tools/gold/vectorize.ll b/test/tools/gold/vectorize.ll
deleted file mode 100644 (file)
index 5f003dd..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-; RUN: llvm-as %s -o %t.o
-
-; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold.so \
-; RUN:    --plugin-opt=save-temps \
-; RUN:    -shared %t.o -o %t2.o
-; RUN: llvm-dis %t2.o.opt.bc -o - | FileCheck %s
-
-; test that the vectorizer is run.
-; CHECK: fadd <4 x float>
-
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
-target triple = "x86_64-unknown-linux-gnu"
-
-define void @f(float* nocapture %x, i64 %n) {
-bb:
-  br label %bb1
-
-bb1:
-  %i.0 = phi i64 [ 0, %bb ], [ %tmp4, %bb1 ]
-  %tmp = getelementptr inbounds float, float* %x, i64 %i.0
-  %tmp2 = load float, float* %tmp, align 4
-  %tmp3 = fadd float %tmp2, 1.000000e+00
-  store float %tmp3, float* %tmp, align 4
-  %tmp4 = add nsw i64 %i.0, 1
-  %tmp5 = icmp slt i64 %tmp4, %n
-  br i1 %tmp5, label %bb1, label %bb6
-
-bb6:
-  ret void
-}
diff --git a/test/tools/gold/weak.ll b/test/tools/gold/weak.ll
deleted file mode 100644 (file)
index 6d8d7a8..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-; RUN: llvm-as %s -o %t.o
-; RUN: llvm-as %p/Inputs/weak.ll -o %t2.o
-
-; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
-; RUN:    --plugin-opt=emit-llvm \
-; RUN:    -shared %t.o %t2.o -o %t3.o
-; RUN: llvm-dis %t3.o -o - | FileCheck %s
-
-@a = weak global i32 42
-@b = global i32* @a
-
-; Test that @b and @c end up pointing to the same variable.
-
-; CHECK: @a = weak global i32 42
-; CHECK: @b = global i32* @a{{$}}
-; CHECK: @c = global i32* @a{{$}}