aboutsummaryrefslogtreecommitdiff
path: root/test/LTO
diff options
context:
space:
mode:
Diffstat (limited to 'test/LTO')
-rw-r--r--test/LTO/Inputs/bcsection.macho.s2
-rw-r--r--test/LTO/Inputs/bcsection.s2
-rw-r--r--test/LTO/Inputs/invalid.ll.bcbin0 -> 332 bytes
-rw-r--r--test/LTO/Inputs/list-symbols.ll4
-rw-r--r--test/LTO/bcsection.ll21
-rw-r--r--test/LTO/cfi_endproc.ll5
-rw-r--r--test/LTO/diagnostic-handler-remarks.ll40
-rw-r--r--test/LTO/invalid.ll4
-rw-r--r--test/LTO/jump-table-type.ll4
-rw-r--r--test/LTO/linkonce_odr_func.ll10
-rw-r--r--test/LTO/list-symbols.ll15
11 files changed, 105 insertions, 2 deletions
diff --git a/test/LTO/Inputs/bcsection.macho.s b/test/LTO/Inputs/bcsection.macho.s
new file mode 100644
index 000000000000..cb7fe03b3e73
--- /dev/null
+++ b/test/LTO/Inputs/bcsection.macho.s
@@ -0,0 +1,2 @@
+.section .llvmbc,.llvmbc
+.incbin "bcsection.bc"
diff --git a/test/LTO/Inputs/bcsection.s b/test/LTO/Inputs/bcsection.s
new file mode 100644
index 000000000000..ede1e5c532dd
--- /dev/null
+++ b/test/LTO/Inputs/bcsection.s
@@ -0,0 +1,2 @@
+.section .llvmbc
+.incbin "bcsection.bc"
diff --git a/test/LTO/Inputs/invalid.ll.bc b/test/LTO/Inputs/invalid.ll.bc
new file mode 100644
index 000000000000..a85c3644b3ab
--- /dev/null
+++ b/test/LTO/Inputs/invalid.ll.bc
Binary files differ
diff --git a/test/LTO/Inputs/list-symbols.ll b/test/LTO/Inputs/list-symbols.ll
new file mode 100644
index 000000000000..9443d535503a
--- /dev/null
+++ b/test/LTO/Inputs/list-symbols.ll
@@ -0,0 +1,4 @@
+@glob = global i32 0
+define void @bar() {
+ ret void
+}
diff --git a/test/LTO/bcsection.ll b/test/LTO/bcsection.ll
new file mode 100644
index 000000000000..e65ade623536
--- /dev/null
+++ b/test/LTO/bcsection.ll
@@ -0,0 +1,21 @@
+; RUN: llvm-as -o %T/bcsection.bc %s
+
+; RUN: llvm-mc -I=%T -filetype=obj -triple=x86_64-pc-win32 -o %T/bcsection.coff.bco %p/Inputs/bcsection.s
+; RUN: llvm-nm %T/bcsection.coff.bco | FileCheck %s
+; RUN: llvm-lto -exported-symbol=main -exported-symbol=_main -o %T/bcsection.coff.o %T/bcsection.coff.bco
+; RUN: llvm-nm %T/bcsection.coff.o | FileCheck %s
+
+; RUN: llvm-mc -I=%T -filetype=obj -triple=x86_64-unknown-linux-gnu -o %T/bcsection.elf.bco %p/Inputs/bcsection.s
+; RUN: llvm-nm %T/bcsection.elf.bco | FileCheck %s
+; RUN: llvm-lto -exported-symbol=main -exported-symbol=_main -o %T/bcsection.elf.o %T/bcsection.elf.bco
+; RUN: llvm-nm %T/bcsection.elf.o | FileCheck %s
+
+; RUN: llvm-mc -I=%T -filetype=obj -triple=x86_64-apple-darwin11 -o %T/bcsection.macho.bco %p/Inputs/bcsection.macho.s
+; RUN: llvm-nm %T/bcsection.macho.bco | FileCheck %s
+; RUN: llvm-lto -exported-symbol=main -exported-symbol=_main -o %T/bcsection.macho.o %T/bcsection.macho.bco
+; RUN: llvm-nm %T/bcsection.macho.o | FileCheck %s
+
+; CHECK: main
+define i32 @main() {
+ ret i32 0
+}
diff --git a/test/LTO/cfi_endproc.ll b/test/LTO/cfi_endproc.ll
index a5cc649fc863..1a69bf60f54b 100644
--- a/test/LTO/cfi_endproc.ll
+++ b/test/LTO/cfi_endproc.ll
@@ -35,3 +35,8 @@ define i32* @get_zed1() {
; ZED1_AND_ZED2: d zed2
@zed2 = linkonce_odr unnamed_addr global i32 42
+
+define i32 @useZed2() {
+ %x = load i32* @zed2
+ ret i32 %x
+}
diff --git a/test/LTO/diagnostic-handler-remarks.ll b/test/LTO/diagnostic-handler-remarks.ll
new file mode 100644
index 000000000000..4da9101117ec
--- /dev/null
+++ b/test/LTO/diagnostic-handler-remarks.ll
@@ -0,0 +1,40 @@
+; RUN: llvm-as < %s >%t.bc
+; PR21108: Diagnostic handlers get pass remarks, even if they're not enabled.
+
+; Confirm that there are -pass-remarks.
+; RUN: llvm-lto -pass-remarks=inline \
+; RUN: -exported-symbol _main -o %t.o %t.bc 2>&1 | \
+; RUN: FileCheck %s -allow-empty -check-prefix=REMARKS
+; RUN: llvm-nm %t.o | FileCheck %s -check-prefix NM
+
+; RUN: llvm-lto -pass-remarks=inline -use-diagnostic-handler \
+; RUN: -exported-symbol _main -o %t.o %t.bc 2>&1 | \
+; RUN: FileCheck %s -allow-empty -check-prefix=REMARKS
+; RUN: llvm-nm %t.o | FileCheck %s -check-prefix NM
+
+; Confirm that -pass-remarks are not printed by default.
+; RUN: llvm-lto \
+; RUN: -exported-symbol _main -o %t.o %t.bc 2>&1 | \
+; RUN: FileCheck %s -allow-empty
+; RUN: llvm-nm %t.o | FileCheck %s -check-prefix NM
+
+; RUN: llvm-lto -use-diagnostic-handler \
+; RUN: -exported-symbol _main -o %t.o %t.bc 2>&1 | \
+; RUN: FileCheck %s -allow-empty
+; RUN: llvm-nm %t.o | FileCheck %s -check-prefix NM
+
+; REMARKS: remark:
+; CHECK-NOT: remark:
+; NM-NOT: foo
+; NM: main
+
+target triple = "x86_64-apple-darwin"
+
+define i32 @foo() {
+ ret i32 7
+}
+
+define i32 @main() {
+ %i = call i32 @foo()
+ ret i32 %i
+}
diff --git a/test/LTO/invalid.ll b/test/LTO/invalid.ll
new file mode 100644
index 000000000000..5b6996d4ad35
--- /dev/null
+++ b/test/LTO/invalid.ll
@@ -0,0 +1,4 @@
+; RUN: not llvm-lto %S/Inputs/invalid.ll.bc 2>&1 | FileCheck %s
+
+
+; CHECK: llvm-lto{{.*}}: error loading file '{{.*}}/Inputs/invalid.ll.bc': Unknown attribute kind (48)
diff --git a/test/LTO/jump-table-type.ll b/test/LTO/jump-table-type.ll
index a39d3e959830..a806c303f8c5 100644
--- a/test/LTO/jump-table-type.ll
+++ b/test/LTO/jump-table-type.ll
@@ -2,8 +2,8 @@
; RUN: llvm-lto -o %t2 %t1 -jump-table-type=arity
; RUN: llvm-nm %t2 | FileCheck %s
-; CHECK: T __llvm_jump_instr_table_0_1
-; CHECK: T __llvm_jump_instr_table_1_1
+; CHECK: t __llvm_jump_instr_table_0_1
+; CHECK: t __llvm_jump_instr_table_1_1
target triple = "x86_64-unknown-linux-gnu"
diff --git a/test/LTO/linkonce_odr_func.ll b/test/LTO/linkonce_odr_func.ll
index a67ffc0dd48e..48da7953885f 100644
--- a/test/LTO/linkonce_odr_func.ll
+++ b/test/LTO/linkonce_odr_func.ll
@@ -29,9 +29,19 @@ define linkonce_odr void @foo4() noinline {
; CHECK: r v1
@v1 = linkonce_odr constant i32 32
+define i32 @useV1() {
+ %x = load i32* @v1
+ ret i32 %x
+}
+
; CHECK: V v2
@v2 = linkonce_odr global i32 32
+define i32 @useV2() {
+ %x = load i32* @v2
+ ret i32 %x
+}
+
declare void @f(void()*)
declare void @p()
diff --git a/test/LTO/list-symbols.ll b/test/LTO/list-symbols.ll
new file mode 100644
index 000000000000..41b7d00deecc
--- /dev/null
+++ b/test/LTO/list-symbols.ll
@@ -0,0 +1,15 @@
+; RUN: llvm-as -o %T/1.bc %s
+; RUN: llvm-as -o %T/2.bc %S/Inputs/list-symbols.ll
+; RUN: llvm-lto -list-symbols-only %T/1.bc %T/2.bc | FileCheck %s
+
+; CHECK-LABEL: 1.bc:
+; CHECK-DAG: foo
+; CHECK-DAG: glob
+; CHECK-LABEL: 2.bc:
+; CHECK-DAG: glob
+; CHECK-DAG: bar
+
+@glob = global i32 0
+define void @foo() {
+ ret void
+}