From: NAKAMURA Takumi Date: Fri, 30 Jan 2015 10:09:26 +0000 (+0000) Subject: Introduce llvm/test/LTO/X86. LTO tests may be assumed as target-specific. X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=commitdiff_plain;h=e21839b3771cc95a3ae23bb7a13e74df14ad5ea3 Introduce llvm/test/LTO/X86. LTO tests may be assumed as target-specific. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@227564 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/LTO/Inputs/bcsection.macho.s b/test/LTO/Inputs/bcsection.macho.s deleted file mode 100644 index cb7fe03b3e7..00000000000 --- a/test/LTO/Inputs/bcsection.macho.s +++ /dev/null @@ -1,2 +0,0 @@ -.section .llvmbc,.llvmbc -.incbin "bcsection.bc" diff --git a/test/LTO/Inputs/bcsection.s b/test/LTO/Inputs/bcsection.s deleted file mode 100644 index ede1e5c532d..00000000000 --- a/test/LTO/Inputs/bcsection.s +++ /dev/null @@ -1,2 +0,0 @@ -.section .llvmbc -.incbin "bcsection.bc" diff --git a/test/LTO/Inputs/invalid.ll.bc b/test/LTO/Inputs/invalid.ll.bc deleted file mode 100644 index a85c3644b3a..00000000000 Binary files a/test/LTO/Inputs/invalid.ll.bc and /dev/null differ diff --git a/test/LTO/Inputs/list-symbols.ll b/test/LTO/Inputs/list-symbols.ll deleted file mode 100644 index 9443d535503..00000000000 --- a/test/LTO/Inputs/list-symbols.ll +++ /dev/null @@ -1,4 +0,0 @@ -@glob = global i32 0 -define void @bar() { - ret void -} diff --git a/test/LTO/X86/Inputs/bcsection.macho.s b/test/LTO/X86/Inputs/bcsection.macho.s new file mode 100644 index 00000000000..cb7fe03b3e7 --- /dev/null +++ b/test/LTO/X86/Inputs/bcsection.macho.s @@ -0,0 +1,2 @@ +.section .llvmbc,.llvmbc +.incbin "bcsection.bc" diff --git a/test/LTO/X86/Inputs/bcsection.s b/test/LTO/X86/Inputs/bcsection.s new file mode 100644 index 00000000000..ede1e5c532d --- /dev/null +++ b/test/LTO/X86/Inputs/bcsection.s @@ -0,0 +1,2 @@ +.section .llvmbc +.incbin "bcsection.bc" diff --git a/test/LTO/X86/Inputs/invalid.ll.bc b/test/LTO/X86/Inputs/invalid.ll.bc new file mode 100644 index 00000000000..a85c3644b3a Binary files /dev/null and b/test/LTO/X86/Inputs/invalid.ll.bc differ diff --git a/test/LTO/X86/Inputs/list-symbols.ll b/test/LTO/X86/Inputs/list-symbols.ll new file mode 100644 index 00000000000..9443d535503 --- /dev/null +++ b/test/LTO/X86/Inputs/list-symbols.ll @@ -0,0 +1,4 @@ +@glob = global i32 0 +define void @bar() { + ret void +} diff --git a/test/LTO/X86/attrs.ll b/test/LTO/X86/attrs.ll new file mode 100644 index 00000000000..d1967470cdd --- /dev/null +++ b/test/LTO/X86/attrs.ll @@ -0,0 +1,15 @@ +; RUN: llvm-as < %s >%t1 +; RUN: llvm-lto -exported-symbol=test_x86_aesni_aeskeygenassist -mattr=+aes -o %t2 %t1 +; RUN: llvm-objdump -d %t2 | FileCheck -check-prefix=WITH_AES %s +; RUN: not llvm-lto -exported-symbol=test_x86_aesni_aeskeygenassist -mattr=-aes -o %t3 %t1 2>&1 | FileCheck -check-prefix=WITHOUT_AES %s + +target triple = "x86_64-unknown-linux-gnu" +declare <2 x i64> @llvm.x86.aesni.aeskeygenassist(<2 x i64>, i8) +define <2 x i64> @test_x86_aesni_aeskeygenassist(<2 x i64> %a0) { + ; WITH_AES: test_x86_aesni_aeskeygenassist + ; WITH_AES: aeskeygenassist + %res = call <2 x i64> @llvm.x86.aesni.aeskeygenassist(<2 x i64> %a0, i8 7) + ret <2 x i64> %res +} + +; WITHOUT_AES: LLVM ERROR: Cannot select: intrinsic %llvm.x86.aesni.aeskeygenassist diff --git a/test/LTO/X86/bcsection.ll b/test/LTO/X86/bcsection.ll new file mode 100644 index 00000000000..e65ade62353 --- /dev/null +++ b/test/LTO/X86/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/X86/cfi_endproc.ll b/test/LTO/X86/cfi_endproc.ll new file mode 100644 index 00000000000..1a69bf60f54 --- /dev/null +++ b/test/LTO/X86/cfi_endproc.ll @@ -0,0 +1,42 @@ +; RUN: llvm-as < %s >%t1 +; RUN: llvm-lto -o %t2 %t1 +; RUN: llvm-nm %t2 | FileCheck %s -check-prefix=NOEXPORT +; RUN: llvm-lto -o %t3 -exported-symbol=main %t1 +; RUN: llvm-nm %t3 | FileCheck %s -check-prefix=EXPORT + +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +module asm ".text" +module asm ".align 16, 0x90" +module asm ".type PR14512, @function" +module asm "PR14512:.cfi_startproc" +module asm "ret" +module asm ".cfi_endproc" + +declare void @PR14512() + +; Without -exported-symbol, main should be eliminated by LTO. +; With -exported-symbol=main, main should be preserved by LTO. +define i32 @main(i32 %argc, i8** %argv) { +; NOEXPORT-NOT: main +; EXPORT: main + call void @PR14512() + ret i32 0 +} + +; RUN: llvm-lto -o %t -dso-symbol=zed1 -dso-symbol=zed2 %t1 -disable-opt +; RUN: llvm-nm %t | FileCheck %s -check-prefix=ZED1_AND_ZED2 +; ZED1_AND_ZED2: V zed1 +@zed1 = linkonce_odr global i32 42 +define i32* @get_zed1() { + ret i32* @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/X86/current-section.ll b/test/LTO/X86/current-section.ll new file mode 100644 index 00000000000..f79b378318d --- /dev/null +++ b/test/LTO/X86/current-section.ll @@ -0,0 +1,4 @@ +; RUN: llvm-as < %s >%t1 +; RUN: llvm-lto -o %t2 %t1 + +module asm ".align 4" diff --git a/test/LTO/X86/diagnostic-handler-remarks.ll b/test/LTO/X86/diagnostic-handler-remarks.ll new file mode 100644 index 00000000000..4da9101117e --- /dev/null +++ b/test/LTO/X86/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/X86/invalid.ll b/test/LTO/X86/invalid.ll new file mode 100644 index 00000000000..5b6996d4ad3 --- /dev/null +++ b/test/LTO/X86/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/X86/jump-table-type.ll b/test/LTO/X86/jump-table-type.ll new file mode 100644 index 00000000000..a806c303f8c --- /dev/null +++ b/test/LTO/X86/jump-table-type.ll @@ -0,0 +1,23 @@ +; RUN: llvm-as <%s >%t1 +; 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 + +target triple = "x86_64-unknown-linux-gnu" + +define i32 @g(i32 %a) unnamed_addr jumptable { + ret i32 %a +} + +define i32 @f() unnamed_addr jumptable { + ret i32 0 +} + +define i32 @main() { + ret i32 0 +} + +@llvm.used = appending global [2 x i8*] [i8* bitcast (i32(i32)* @g to i8*), + i8* bitcast (i32()* @f to i8*)] diff --git a/test/LTO/X86/keep-used-puts-during-instcombine.ll b/test/LTO/X86/keep-used-puts-during-instcombine.ll new file mode 100644 index 00000000000..69ce3ee3fae --- /dev/null +++ b/test/LTO/X86/keep-used-puts-during-instcombine.ll @@ -0,0 +1,36 @@ +; RUN: opt -S -instcombine <%s | FileCheck %s +; rdar://problem/16165191 +; llvm.compiler.used functions should not be renamed + +target triple = "x86_64-apple-darwin11" + +@llvm.compiler.used = appending global [1 x i8*] [ + i8* bitcast (i32(i8*)* @puts to i8*) + ], section "llvm.metadata" +@llvm.used = appending global [1 x i8*] [ + i8* bitcast (i32(i32)* @uses_printf to i8*) + ], section "llvm.metadata" + +@str = private unnamed_addr constant [13 x i8] c"hello world\0A\00" + +define i32 @uses_printf(i32 %i) { +entry: + %s = getelementptr [13 x i8]* @str, i64 0, i64 0 + call i32 (i8*, ...)* @printf(i8* %s) + ret i32 0 +} + +define internal i32 @printf(i8* readonly nocapture %fmt, ...) { +entry: + %ret = call i32 @bar(i8* %fmt) + ret i32 %ret +} + +; CHECK: define {{.*}} @puts( +define internal i32 @puts(i8* %s) { +entry: + %ret = call i32 @bar(i8* %s) + ret i32 %ret +} + +declare i32 @bar(i8*) diff --git a/test/LTO/X86/linkonce_odr_func.ll b/test/LTO/X86/linkonce_odr_func.ll new file mode 100644 index 00000000000..48da7953885 --- /dev/null +++ b/test/LTO/X86/linkonce_odr_func.ll @@ -0,0 +1,61 @@ +; RUN: llvm-as < %s >%t1 +; RUN: llvm-lto -o %t2 -dso-symbol=foo1 -dso-symbol=foo2 -dso-symbol=foo3 \ +; RUN: -dso-symbol=foo4 -dso-symbol=v1 -dso-symbol=v2 %t1 -disable-opt +; RUN: llvm-nm %t2 | FileCheck %s + +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +; CHECK: t foo1 +define linkonce_odr void @foo1() noinline { + ret void +} + +; CHECK: W foo2 +define linkonce_odr void @foo2() noinline { + ret void +} + +; CHECK: t foo3 +define linkonce_odr void @foo3() noinline { + ret void +} + +; CHECK: W foo4 +define linkonce_odr void @foo4() noinline { + ret void +} + +; 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() + +define void @bar() { +bb0: + call void @foo1() + call void @f(void()* @foo2) + invoke void @foo3() to label %bb1 unwind label %clean +bb1: + invoke void @f(void()* @foo4) to label %bb2 unwind label %clean +bb2: + ret void +clean: + landingpad {i32, i32} personality void()* @p cleanup + ret void +} diff --git a/test/LTO/X86/list-symbols.ll b/test/LTO/X86/list-symbols.ll new file mode 100644 index 00000000000..41b7d00deec --- /dev/null +++ b/test/LTO/X86/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 +} diff --git a/test/LTO/X86/lit.local.cfg b/test/LTO/X86/lit.local.cfg new file mode 100644 index 00000000000..afde89be896 --- /dev/null +++ b/test/LTO/X86/lit.local.cfg @@ -0,0 +1,2 @@ +if not 'X86' in config.root.targets: + config.unsupported = True diff --git a/test/LTO/X86/no-undefined-puts-when-implemented.ll b/test/LTO/X86/no-undefined-puts-when-implemented.ll new file mode 100644 index 00000000000..29db8a63d1d --- /dev/null +++ b/test/LTO/X86/no-undefined-puts-when-implemented.ll @@ -0,0 +1,40 @@ +; RUN: llvm-as <%s >%t1 +; RUN: llvm-lto -exported-symbol=_uses_puts -exported-symbol=_uses_printf -o - %t1 | \ +; RUN: llvm-nm - | \ +; RUN: FileCheck %s +; rdar://problem/16165191 +; runtime library implementations should not be renamed + +target triple = "x86_64-apple-darwin11" + +@str = private unnamed_addr constant [13 x i8] c"hello world\0A\00" + +; CHECK-NOT: U _puts +; CHECK: T _uses_printf +; CHECK: T _uses_puts +define i32 @uses_puts(i32 %i) { +entry: + %s = call i8* @foo(i32 %i) + %ret = call i32 @puts(i8* %s) + ret i32 %ret +} +define i32 @uses_printf(i32 %i) { +entry: + %s = getelementptr [13 x i8]* @str, i64 0, i64 0 + call i32 (i8*, ...)* @printf(i8* %s) + ret i32 0 +} + +define hidden i32 @printf(i8* readonly nocapture %fmt, ...) { +entry: + %ret = call i32 @bar(i8* %fmt) + ret i32 %ret +} +define hidden i32 @puts(i8* %s) { +entry: + %ret = call i32 @bar(i8* %s) + ret i32 %ret +} + +declare i8* @foo(i32) +declare i32 @bar(i8*) diff --git a/test/LTO/X86/private-symbol.ll b/test/LTO/X86/private-symbol.ll new file mode 100644 index 00000000000..e13a393442d --- /dev/null +++ b/test/LTO/X86/private-symbol.ll @@ -0,0 +1,7 @@ +; RUN: llvm-as < %s >%t1 +; RUN: llvm-lto -o %t2 %t1 + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +@.str = private unnamed_addr constant [7 x i8] c"hello\0A\00", align 1 diff --git a/test/LTO/X86/runtime-library.ll b/test/LTO/X86/runtime-library.ll new file mode 100644 index 00000000000..76fc6f0cc47 --- /dev/null +++ b/test/LTO/X86/runtime-library.ll @@ -0,0 +1,27 @@ +; runtime library implementations should be added to llvm.compiler.used +; RUN: llvm-as <%s >%t1 +; RUN: llvm-lto -o %t2 %t1 +; RUN: llvm-nm -no-sort %t2 | FileCheck %s -check-prefix=KEEP -check-prefix=LOSE + +target triple = "x86_64-apple-darwin9" + +; KEEP-LABEL: _puts +define void @puts() { + ret void +} + +; KEEP-LABEL: ___divti3 +define void @__divti3() { + ret void +} + +; KEEP-LABEL: _memset +define void @memset() { + ret void +} + +; LOSE-NOT: _myprintf +define void @myprintf() { + ret void +} + diff --git a/test/LTO/X86/symver-asm.ll b/test/LTO/X86/symver-asm.ll new file mode 100644 index 00000000000..03dda2bedd9 --- /dev/null +++ b/test/LTO/X86/symver-asm.ll @@ -0,0 +1,16 @@ +; RUN: llvm-as < %s >%t1 +; RUN: llvm-lto -o %t2 %t1 +; RUN: llvm-nm %t2 | FileCheck %s + +target triple = "x86_64-unknown-linux-gnu" + +module asm ".symver io_cancel_0_4,io_cancel@@LIBAIO_0.4" + +; Even without -exported-symbol, io_cancel_0_4 should be noticed by LTOModule's +; RecordStreamer, so it shouldn't get eliminated. However, the object file will +; contain the aliased symver as well as the original. +define i32 @io_cancel_0_4() { +; CHECK: io_cancel@@LIBAIO_0.4 +; CHECK: io_cancel_0_4 + ret i32 0 +} diff --git a/test/LTO/X86/triple-init.ll b/test/LTO/X86/triple-init.ll new file mode 100644 index 00000000000..e0ad87967ba --- /dev/null +++ b/test/LTO/X86/triple-init.ll @@ -0,0 +1,16 @@ +; RUN: llvm-as < %s >%t1 +; RUN: llvm-lto -exported-symbol=_main -o %t2 %t1 +; RUN: llvm-nm %t2 | FileCheck %s + +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" + +target triple = "x86_64-apple-macosx10.9" + +declare double @pow(double, double) + +define double @main(double %x) { +; We check that LTO will be aware of target triple and apply pow to __exp10 transformation. +; CHECK: U ___exp10 + %retval = call double @pow(double 10.0, double %x) + ret double %retval +} diff --git a/test/LTO/attrs.ll b/test/LTO/attrs.ll deleted file mode 100644 index d1967470cdd..00000000000 --- a/test/LTO/attrs.ll +++ /dev/null @@ -1,15 +0,0 @@ -; RUN: llvm-as < %s >%t1 -; RUN: llvm-lto -exported-symbol=test_x86_aesni_aeskeygenassist -mattr=+aes -o %t2 %t1 -; RUN: llvm-objdump -d %t2 | FileCheck -check-prefix=WITH_AES %s -; RUN: not llvm-lto -exported-symbol=test_x86_aesni_aeskeygenassist -mattr=-aes -o %t3 %t1 2>&1 | FileCheck -check-prefix=WITHOUT_AES %s - -target triple = "x86_64-unknown-linux-gnu" -declare <2 x i64> @llvm.x86.aesni.aeskeygenassist(<2 x i64>, i8) -define <2 x i64> @test_x86_aesni_aeskeygenassist(<2 x i64> %a0) { - ; WITH_AES: test_x86_aesni_aeskeygenassist - ; WITH_AES: aeskeygenassist - %res = call <2 x i64> @llvm.x86.aesni.aeskeygenassist(<2 x i64> %a0, i8 7) - ret <2 x i64> %res -} - -; WITHOUT_AES: LLVM ERROR: Cannot select: intrinsic %llvm.x86.aesni.aeskeygenassist diff --git a/test/LTO/bcsection.ll b/test/LTO/bcsection.ll deleted file mode 100644 index e65ade62353..00000000000 --- a/test/LTO/bcsection.ll +++ /dev/null @@ -1,21 +0,0 @@ -; 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 deleted file mode 100644 index 1a69bf60f54..00000000000 --- a/test/LTO/cfi_endproc.ll +++ /dev/null @@ -1,42 +0,0 @@ -; RUN: llvm-as < %s >%t1 -; RUN: llvm-lto -o %t2 %t1 -; RUN: llvm-nm %t2 | FileCheck %s -check-prefix=NOEXPORT -; RUN: llvm-lto -o %t3 -exported-symbol=main %t1 -; RUN: llvm-nm %t3 | FileCheck %s -check-prefix=EXPORT - -target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -module asm ".text" -module asm ".align 16, 0x90" -module asm ".type PR14512, @function" -module asm "PR14512:.cfi_startproc" -module asm "ret" -module asm ".cfi_endproc" - -declare void @PR14512() - -; Without -exported-symbol, main should be eliminated by LTO. -; With -exported-symbol=main, main should be preserved by LTO. -define i32 @main(i32 %argc, i8** %argv) { -; NOEXPORT-NOT: main -; EXPORT: main - call void @PR14512() - ret i32 0 -} - -; RUN: llvm-lto -o %t -dso-symbol=zed1 -dso-symbol=zed2 %t1 -disable-opt -; RUN: llvm-nm %t | FileCheck %s -check-prefix=ZED1_AND_ZED2 -; ZED1_AND_ZED2: V zed1 -@zed1 = linkonce_odr global i32 42 -define i32* @get_zed1() { - ret i32* @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/current-section.ll b/test/LTO/current-section.ll deleted file mode 100644 index f79b378318d..00000000000 --- a/test/LTO/current-section.ll +++ /dev/null @@ -1,4 +0,0 @@ -; RUN: llvm-as < %s >%t1 -; RUN: llvm-lto -o %t2 %t1 - -module asm ".align 4" diff --git a/test/LTO/diagnostic-handler-remarks.ll b/test/LTO/diagnostic-handler-remarks.ll deleted file mode 100644 index 4da9101117e..00000000000 --- a/test/LTO/diagnostic-handler-remarks.ll +++ /dev/null @@ -1,40 +0,0 @@ -; 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 deleted file mode 100644 index 5b6996d4ad3..00000000000 --- a/test/LTO/invalid.ll +++ /dev/null @@ -1,4 +0,0 @@ -; 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 deleted file mode 100644 index a806c303f8c..00000000000 --- a/test/LTO/jump-table-type.ll +++ /dev/null @@ -1,23 +0,0 @@ -; RUN: llvm-as <%s >%t1 -; 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 - -target triple = "x86_64-unknown-linux-gnu" - -define i32 @g(i32 %a) unnamed_addr jumptable { - ret i32 %a -} - -define i32 @f() unnamed_addr jumptable { - ret i32 0 -} - -define i32 @main() { - ret i32 0 -} - -@llvm.used = appending global [2 x i8*] [i8* bitcast (i32(i32)* @g to i8*), - i8* bitcast (i32()* @f to i8*)] diff --git a/test/LTO/keep-used-puts-during-instcombine.ll b/test/LTO/keep-used-puts-during-instcombine.ll deleted file mode 100644 index 69ce3ee3fae..00000000000 --- a/test/LTO/keep-used-puts-during-instcombine.ll +++ /dev/null @@ -1,36 +0,0 @@ -; RUN: opt -S -instcombine <%s | FileCheck %s -; rdar://problem/16165191 -; llvm.compiler.used functions should not be renamed - -target triple = "x86_64-apple-darwin11" - -@llvm.compiler.used = appending global [1 x i8*] [ - i8* bitcast (i32(i8*)* @puts to i8*) - ], section "llvm.metadata" -@llvm.used = appending global [1 x i8*] [ - i8* bitcast (i32(i32)* @uses_printf to i8*) - ], section "llvm.metadata" - -@str = private unnamed_addr constant [13 x i8] c"hello world\0A\00" - -define i32 @uses_printf(i32 %i) { -entry: - %s = getelementptr [13 x i8]* @str, i64 0, i64 0 - call i32 (i8*, ...)* @printf(i8* %s) - ret i32 0 -} - -define internal i32 @printf(i8* readonly nocapture %fmt, ...) { -entry: - %ret = call i32 @bar(i8* %fmt) - ret i32 %ret -} - -; CHECK: define {{.*}} @puts( -define internal i32 @puts(i8* %s) { -entry: - %ret = call i32 @bar(i8* %s) - ret i32 %ret -} - -declare i32 @bar(i8*) diff --git a/test/LTO/linkonce_odr_func.ll b/test/LTO/linkonce_odr_func.ll deleted file mode 100644 index 48da7953885..00000000000 --- a/test/LTO/linkonce_odr_func.ll +++ /dev/null @@ -1,61 +0,0 @@ -; RUN: llvm-as < %s >%t1 -; RUN: llvm-lto -o %t2 -dso-symbol=foo1 -dso-symbol=foo2 -dso-symbol=foo3 \ -; RUN: -dso-symbol=foo4 -dso-symbol=v1 -dso-symbol=v2 %t1 -disable-opt -; RUN: llvm-nm %t2 | FileCheck %s - -target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -; CHECK: t foo1 -define linkonce_odr void @foo1() noinline { - ret void -} - -; CHECK: W foo2 -define linkonce_odr void @foo2() noinline { - ret void -} - -; CHECK: t foo3 -define linkonce_odr void @foo3() noinline { - ret void -} - -; CHECK: W foo4 -define linkonce_odr void @foo4() noinline { - ret void -} - -; 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() - -define void @bar() { -bb0: - call void @foo1() - call void @f(void()* @foo2) - invoke void @foo3() to label %bb1 unwind label %clean -bb1: - invoke void @f(void()* @foo4) to label %bb2 unwind label %clean -bb2: - ret void -clean: - landingpad {i32, i32} personality void()* @p cleanup - ret void -} diff --git a/test/LTO/list-symbols.ll b/test/LTO/list-symbols.ll deleted file mode 100644 index 41b7d00deec..00000000000 --- a/test/LTO/list-symbols.ll +++ /dev/null @@ -1,15 +0,0 @@ -; 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 -} diff --git a/test/LTO/lit.local.cfg b/test/LTO/lit.local.cfg deleted file mode 100644 index afde89be896..00000000000 --- a/test/LTO/lit.local.cfg +++ /dev/null @@ -1,2 +0,0 @@ -if not 'X86' in config.root.targets: - config.unsupported = True diff --git a/test/LTO/no-undefined-puts-when-implemented.ll b/test/LTO/no-undefined-puts-when-implemented.ll deleted file mode 100644 index 29db8a63d1d..00000000000 --- a/test/LTO/no-undefined-puts-when-implemented.ll +++ /dev/null @@ -1,40 +0,0 @@ -; RUN: llvm-as <%s >%t1 -; RUN: llvm-lto -exported-symbol=_uses_puts -exported-symbol=_uses_printf -o - %t1 | \ -; RUN: llvm-nm - | \ -; RUN: FileCheck %s -; rdar://problem/16165191 -; runtime library implementations should not be renamed - -target triple = "x86_64-apple-darwin11" - -@str = private unnamed_addr constant [13 x i8] c"hello world\0A\00" - -; CHECK-NOT: U _puts -; CHECK: T _uses_printf -; CHECK: T _uses_puts -define i32 @uses_puts(i32 %i) { -entry: - %s = call i8* @foo(i32 %i) - %ret = call i32 @puts(i8* %s) - ret i32 %ret -} -define i32 @uses_printf(i32 %i) { -entry: - %s = getelementptr [13 x i8]* @str, i64 0, i64 0 - call i32 (i8*, ...)* @printf(i8* %s) - ret i32 0 -} - -define hidden i32 @printf(i8* readonly nocapture %fmt, ...) { -entry: - %ret = call i32 @bar(i8* %fmt) - ret i32 %ret -} -define hidden i32 @puts(i8* %s) { -entry: - %ret = call i32 @bar(i8* %s) - ret i32 %ret -} - -declare i8* @foo(i32) -declare i32 @bar(i8*) diff --git a/test/LTO/private-symbol.ll b/test/LTO/private-symbol.ll deleted file mode 100644 index e13a393442d..00000000000 --- a/test/LTO/private-symbol.ll +++ /dev/null @@ -1,7 +0,0 @@ -; RUN: llvm-as < %s >%t1 -; RUN: llvm-lto -o %t2 %t1 - -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -@.str = private unnamed_addr constant [7 x i8] c"hello\0A\00", align 1 diff --git a/test/LTO/runtime-library.ll b/test/LTO/runtime-library.ll deleted file mode 100644 index 76fc6f0cc47..00000000000 --- a/test/LTO/runtime-library.ll +++ /dev/null @@ -1,27 +0,0 @@ -; runtime library implementations should be added to llvm.compiler.used -; RUN: llvm-as <%s >%t1 -; RUN: llvm-lto -o %t2 %t1 -; RUN: llvm-nm -no-sort %t2 | FileCheck %s -check-prefix=KEEP -check-prefix=LOSE - -target triple = "x86_64-apple-darwin9" - -; KEEP-LABEL: _puts -define void @puts() { - ret void -} - -; KEEP-LABEL: ___divti3 -define void @__divti3() { - ret void -} - -; KEEP-LABEL: _memset -define void @memset() { - ret void -} - -; LOSE-NOT: _myprintf -define void @myprintf() { - ret void -} - diff --git a/test/LTO/symver-asm.ll b/test/LTO/symver-asm.ll deleted file mode 100644 index 03dda2bedd9..00000000000 --- a/test/LTO/symver-asm.ll +++ /dev/null @@ -1,16 +0,0 @@ -; RUN: llvm-as < %s >%t1 -; RUN: llvm-lto -o %t2 %t1 -; RUN: llvm-nm %t2 | FileCheck %s - -target triple = "x86_64-unknown-linux-gnu" - -module asm ".symver io_cancel_0_4,io_cancel@@LIBAIO_0.4" - -; Even without -exported-symbol, io_cancel_0_4 should be noticed by LTOModule's -; RecordStreamer, so it shouldn't get eliminated. However, the object file will -; contain the aliased symver as well as the original. -define i32 @io_cancel_0_4() { -; CHECK: io_cancel@@LIBAIO_0.4 -; CHECK: io_cancel_0_4 - ret i32 0 -} diff --git a/test/LTO/triple-init.ll b/test/LTO/triple-init.ll deleted file mode 100644 index e0ad87967ba..00000000000 --- a/test/LTO/triple-init.ll +++ /dev/null @@ -1,16 +0,0 @@ -; RUN: llvm-as < %s >%t1 -; RUN: llvm-lto -exported-symbol=_main -o %t2 %t1 -; RUN: llvm-nm %t2 | FileCheck %s - -target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" - -target triple = "x86_64-apple-macosx10.9" - -declare double @pow(double, double) - -define double @main(double %x) { -; We check that LTO will be aware of target triple and apply pow to __exp10 transformation. -; CHECK: U ___exp10 - %retval = call double @pow(double 10.0, double %x) - ret double %retval -}