diff options
Diffstat (limited to 'test/ELF/lto')
44 files changed, 206 insertions, 47 deletions
diff --git a/test/ELF/lto/Inputs/common3.ll b/test/ELF/lto/Inputs/common3.ll new file mode 100644 index 0000000000000..a4efc65915703 --- /dev/null +++ b/test/ELF/lto/Inputs/common3.ll @@ -0,0 +1,3 @@ +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" +@a = common hidden global i64 0, align 4 diff --git a/test/ELF/lto/Inputs/thin1.ll b/test/ELF/lto/Inputs/thin1.ll new file mode 100644 index 0000000000000..93029837714b7 --- /dev/null +++ b/test/ELF/lto/Inputs/thin1.ll @@ -0,0 +1,12 @@ +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-scei-ps4" + +define i32 @foo(i32 %goo) { +entry: + %goo.addr = alloca i32, align 4 + store i32 %goo, i32* %goo.addr, align 4 + %0 = load i32, i32* %goo.addr, align 4 + %1 = load i32, i32* %goo.addr, align 4 + %mul = mul nsw i32 %0, %1 + ret i32 %mul +} diff --git a/test/ELF/lto/Inputs/thin2.ll b/test/ELF/lto/Inputs/thin2.ll new file mode 100644 index 0000000000000..6cffbdcc53f26 --- /dev/null +++ b/test/ELF/lto/Inputs/thin2.ll @@ -0,0 +1,11 @@ +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-scei-ps4" + +define i32 @blah(i32 %meh) #0 { +entry: + %meh.addr = alloca i32, align 4 + store i32 %meh, i32* %meh.addr, align 4 + %0 = load i32, i32* %meh.addr, align 4 + %sub = sub nsw i32 %0, 48 + ret i32 %sub +} diff --git a/test/ELF/lto/Inputs/thinlto.ll b/test/ELF/lto/Inputs/thinlto.ll new file mode 100644 index 0000000000000..31c72ec4653a6 --- /dev/null +++ b/test/ELF/lto/Inputs/thinlto.ll @@ -0,0 +1,7 @@ +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +define void @g() { +entry: + ret void +} diff --git a/test/ELF/lto/Inputs/unnamed-addr-drop.ll b/test/ELF/lto/Inputs/unnamed-addr-drop.ll new file mode 100644 index 0000000000000..b91bc8e5a891c --- /dev/null +++ b/test/ELF/lto/Inputs/unnamed-addr-drop.ll @@ -0,0 +1,4 @@ +target triple = "x86_64-unknown-linux-gnu" +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + +@foo = unnamed_addr constant i32 42 diff --git a/test/ELF/lto/archive-3.ll b/test/ELF/lto/archive-3.ll index 350c8929c9df8..0322e412539a6 100644 --- a/test/ELF/lto/archive-3.ll +++ b/test/ELF/lto/archive-3.ll @@ -3,12 +3,12 @@ ; RUN: llvm-as %s -o %t2.o ; RUN: ld.lld -m elf_x86_64 %t1.o %t2.o -o %t3 -save-temps -; RUN: llvm-dis %t3.lto.bc -o - | FileCheck %s +; RUN: llvm-dis %t3.0.2.internalize.bc -o - | FileCheck %s ; RUN: rm -f %t.a ; RUN: llvm-ar rcs %t.a %t1.o ; RUN: ld.lld -m elf_x86_64 %t.a %t1.o %t2.o -o %t3 -save-temps -; RUN: llvm-dis %t3.lto.bc -o - | FileCheck %s +; RUN: llvm-dis %t3.0.2.internalize.bc -o - | FileCheck %s ; CHECK: define internal void @foo() { diff --git a/test/ELF/lto/archive.ll b/test/ELF/lto/archive.ll index b3f69fb9920f1..b4d011fdb8886 100644 --- a/test/ELF/lto/archive.ll +++ b/test/ELF/lto/archive.ll @@ -8,7 +8,6 @@ ; RUN: ld.lld -m elf_x86_64 %t2.o --whole-archive %t.a -o %t3 -shared ; RUN: llvm-readobj -t %t3 | FileCheck %s - ; CHECK: Name: g ( ; CHECK-NEXT: Value: ; CHECK-NEXT: Size: diff --git a/test/ELF/lto/asmundef.ll b/test/ELF/lto/asmundef.ll index d76e418fce819..1c87cd01fad8c 100644 --- a/test/ELF/lto/asmundef.ll +++ b/test/ELF/lto/asmundef.ll @@ -1,7 +1,7 @@ ; REQUIRES: x86 ; RUN: llvm-as %s -o %t.o ; RUN: ld.lld -m elf_x86_64 %t.o -o %t -save-temps -; RUN: llvm-dis %t.lto.bc -o - | FileCheck %s +; RUN: llvm-dis %t.0.4.opt.bc -o - | FileCheck %s target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" diff --git a/test/ELF/lto/available-externally.ll b/test/ELF/lto/available-externally.ll index 74aa86002c9e9..181042b9d1e1c 100644 --- a/test/ELF/lto/available-externally.ll +++ b/test/ELF/lto/available-externally.ll @@ -1,7 +1,7 @@ ; RUN: llvm-as %s -o %t1.o ; RUN: llvm-as %p/Inputs/available-externally.ll -o %t2.o ; RUN: ld.lld %t1.o %t2.o -m elf_x86_64 -o %t.so -shared -save-temps -; RUN: llvm-dis < %t.so.lto.bc | FileCheck %s +; RUN: llvm-dis < %t.so.0.2.internalize.bc | FileCheck %s target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" diff --git a/test/ELF/lto/invalid-bitcode.ll b/test/ELF/lto/bitcode-nodatalayout.ll index eceffb10d8ad4..5c4883a42444e 100644 --- a/test/ELF/lto/invalid-bitcode.ll +++ b/test/ELF/lto/bitcode-nodatalayout.ll @@ -1,10 +1,11 @@ ; REQUIRES: x86 ; RUN: llvm-as %s -o %t.o -; RUN: not ld.lld -m elf_x86_64 %t.o 2>&1 | FileCheck %s +; RUN: not ld.lld -m elf_x86_64 %t.o -o %t 2>&1 | FileCheck %s -; CHECK: invalid bitcode file: +; CHECK: input module has no datalayout ; This bitcode file has no datalayout. +; Check that we error out producing a reasonable diagnostic. target triple = "x86_64-unknown-linux-gnu" define void @_start() { diff --git a/test/ELF/lto/combined-lto-object-name.ll b/test/ELF/lto/combined-lto-object-name.ll index f5b7e3ae40e68..f46efc4f7387c 100644 --- a/test/ELF/lto/combined-lto-object-name.ll +++ b/test/ELF/lto/combined-lto-object-name.ll @@ -11,4 +11,4 @@ define void @_start() { ret void } -; CHECK: undefined symbol: foo in {{.*}}combined-lto-object-name.ll.tmp.o +; CHECK: error: ld-temp.o:(function _start): undefined symbol 'foo' diff --git a/test/ELF/lto/common2.ll b/test/ELF/lto/common2.ll index 59a2676e4fc95..b44bbac4fda31 100644 --- a/test/ELF/lto/common2.ll +++ b/test/ELF/lto/common2.ll @@ -1,21 +1,24 @@ ; RUN: llvm-as %s -o %t1.o ; RUN: ld.lld -m elf_x86_64 %t1.o -o %t -shared -save-temps -; RUN: llvm-dis < %t.lto.bc | FileCheck %s +; RUN: llvm-dis < %t.0.2.internalize.bc | FileCheck %s ; RUN: llvm-readobj -t %t | FileCheck %s --check-prefix=SHARED target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" @a = common global i8 0, align 8 +; CHECK-DAG: @a = common global i8 0, align 8 -; Shared library case, we ensure that the bitcode generated file -; has not the a symbol but is appears in the final shared library -; produced. -; CHECK-NOT: @a = common global i8 0, align 8 +@b = common hidden global i32 0, align 4 +define i32 @f() { + %t = load i32, i32* @b, align 4 + ret i32 %t +} +; CHECK-DAG: @b = internal global i32 0, align 4 ; SHARED: Symbol { ; SHARED: Name: a -; SHARED-NEXT: Value: 0x2000 +; SHARED-NEXT: Value: ; SHARED-NEXT: Size: 1 ; SHARED-NEXT: Binding: Global ; SHARED-NEXT: Type: Object diff --git a/test/ELF/lto/common3.ll b/test/ELF/lto/common3.ll new file mode 100644 index 0000000000000..6d40de547fcd6 --- /dev/null +++ b/test/ELF/lto/common3.ll @@ -0,0 +1,14 @@ +; RUN: llvm-as %s -o %t1.o +; RUN: llvm-as %S/Inputs/common3.ll -o %t2.o +; RUN: ld.lld -m elf_x86_64 %t1.o %t2.o -o %t -shared -save-temps +; RUN: llvm-dis < %t.0.2.internalize.bc | FileCheck %s + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" +@a = common hidden global i32 0, align 8 +define i32 @f() { + %t = load i32, i32* @a, align 4 + ret i32 %t +} + +; CHECK: @a = internal global i64 0, align 8 diff --git a/test/ELF/lto/discard-value-names.ll b/test/ELF/lto/discard-value-names.ll index c6cd94fd2e183..c71dc386113dd 100644 --- a/test/ELF/lto/discard-value-names.ll +++ b/test/ELF/lto/discard-value-names.ll @@ -1,7 +1,7 @@ ; RUN: llvm-as %s -o %t.o ; RUN: ld.lld -m elf_x86_64 -shared -save-temps %t.o -o %t2.o -; RUN: llvm-dis < %t2.o.lto.bc | FileCheck %s +; RUN: llvm-dis < %t2.o.0.0.preopt.bc | FileCheck %s ; CHECK: @GlobalValueName ; CHECK: @foo(i32 %in) diff --git a/test/ELF/lto/drop-debug-info.ll b/test/ELF/lto/drop-debug-info.ll index 7a7ed5ea41d1c..27c0260080eb1 100644 --- a/test/ELF/lto/drop-debug-info.ll +++ b/test/ELF/lto/drop-debug-info.ll @@ -5,5 +5,5 @@ ; ; RUN: ld.lld -m elf_x86_64 -shared %p/Inputs/drop-debug-info.bc \ ; RUN: -disable-verify 2>&1 | FileCheck %s -; CHECK: warning: ignoring debug info with an invalid version (1) in {{.*}}drop-debug-info.bc +; CHECK: ignoring debug info with an invalid version (1) in {{.*}}drop-debug-info.bc diff --git a/test/ELF/lto/drop-linkage.ll b/test/ELF/lto/drop-linkage.ll index fd111c18bd131..1ff179666f0e6 100644 --- a/test/ELF/lto/drop-linkage.ll +++ b/test/ELF/lto/drop-linkage.ll @@ -5,7 +5,7 @@ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" ; RUN: llc %s -o %t.o -filetype=obj ; RUN: llvm-as %p/Inputs/drop-linkage.ll -o %t2.o ; RUN: ld.lld %t.o %t2.o -o %t.so -save-temps -shared -; RUN: llvm-dis %t.so.lto.opt.bc -o - | FileCheck %s +; RUN: llvm-dis %t.so.0.4.opt.bc -o - | FileCheck %s define void @foo() { ret void diff --git a/test/ELF/lto/duplicated.ll b/test/ELF/lto/duplicated.ll index 6ef6772c5f207..903592c46067e 100644 --- a/test/ELF/lto/duplicated.ll +++ b/test/ELF/lto/duplicated.ll @@ -1,7 +1,7 @@ ; REQUIRES: x86 ; RUN: llvm-as %s -o %t.o ; RUN: not ld.lld -m elf_x86_64 %t.o %t.o -o %t.so -shared 2>&1 | FileCheck %s -; CHECK: duplicate symbol: f in {{.*}}.o and {{.*}}.o +; CHECK: duplicate symbol 'f' in {{.*}}.o and {{.*}}.o target triple = "x86_64-unknown-linux-gnu" target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" diff --git a/test/ELF/lto/dynsym.ll b/test/ELF/lto/dynsym.ll index 5885960c7bc3a..b2b4157820b56 100644 --- a/test/ELF/lto/dynsym.ll +++ b/test/ELF/lto/dynsym.ll @@ -5,6 +5,11 @@ ; RUN: ld.lld -m elf_x86_64 %t2.o %t.so -o %t ; RUN: llvm-readobj -dyn-symbols %t | FileCheck %s +; Check that we don't crash when gc'ing sections and printing the result. +; RUN: ld.lld -m elf_x86_64 %t2.o %t.so --gc-sections --print-gc-sections \ +; RUN: -o %t +; RUN: llvm-readobj -dyn-symbols %t | FileCheck %s + target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" diff --git a/test/ELF/lto/internalize-basic.ll b/test/ELF/lto/internalize-basic.ll index 396b9cb60f177..43c1837528f53 100644 --- a/test/ELF/lto/internalize-basic.ll +++ b/test/ELF/lto/internalize-basic.ll @@ -1,7 +1,7 @@ ; REQUIRES: x86 ; RUN: llvm-as %s -o %t.o ; RUN: ld.lld -m elf_x86_64 %t.o -o %t2 -save-temps -; RUN: llvm-dis < %t2.lto.bc | FileCheck %s +; RUN: llvm-dis < %t2.0.2.internalize.bc | FileCheck %s target triple = "x86_64-unknown-linux-gnu" target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" diff --git a/test/ELF/lto/internalize-exportdyn.ll b/test/ELF/lto/internalize-exportdyn.ll index bee9a1e6a1ee1..2034a2b3ab72b 100644 --- a/test/ELF/lto/internalize-exportdyn.ll +++ b/test/ELF/lto/internalize-exportdyn.ll @@ -2,7 +2,7 @@ ; RUN: llvm-as %s -o %t.o ; RUN: llvm-as %p/Inputs/internalize-exportdyn.ll -o %t2.o ; RUN: ld.lld -m elf_x86_64 %t.o %t2.o -o %t2 --export-dynamic -save-temps -; RUN: llvm-dis < %t2.lto.bc | FileCheck %s +; RUN: llvm-dis < %t2.0.2.internalize.bc | FileCheck %s target triple = "x86_64-unknown-linux-gnu" target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" diff --git a/test/ELF/lto/internalize-llvmused.ll b/test/ELF/lto/internalize-llvmused.ll index 46c90a65ff726..253dcb26d0421 100644 --- a/test/ELF/lto/internalize-llvmused.ll +++ b/test/ELF/lto/internalize-llvmused.ll @@ -1,7 +1,7 @@ ; REQUIRES: x86 ; RUN: llvm-as %s -o %t.o ; RUN: ld.lld -m elf_x86_64 %t.o -o %t2 -save-temps -; RUN: llvm-dis < %t2.lto.bc | FileCheck %s +; RUN: llvm-dis < %t2.0.2.internalize.bc | FileCheck %s target triple = "x86_64-unknown-linux-gnu" target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" diff --git a/test/ELF/lto/internalize-undef.ll b/test/ELF/lto/internalize-undef.ll index 5d74c31eee8bb..f76528bda3b05 100644 --- a/test/ELF/lto/internalize-undef.ll +++ b/test/ELF/lto/internalize-undef.ll @@ -2,7 +2,7 @@ ; RUN: llvm-as %s -o %t.o ; RUN: llvm-as %p/Inputs/internalize-undef.ll -o %t2.o ; RUN: ld.lld -m elf_x86_64 %t.o %t2.o -o %t -save-temps -; RUN: llvm-dis < %t.lto.bc | FileCheck %s +; RUN: llvm-dis < %t.0.2.internalize.bc | FileCheck %s target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" diff --git a/test/ELF/lto/internalize-version-script.ll b/test/ELF/lto/internalize-version-script.ll index c25328fb56e20..c577e43b50e43 100644 --- a/test/ELF/lto/internalize-version-script.ll +++ b/test/ELF/lto/internalize-version-script.ll @@ -2,7 +2,7 @@ ; RUN: llvm-as %s -o %t.o ; RUN: echo "{ global: foo; local: *; };" > %t.script ; RUN: ld.lld -m elf_x86_64 %t.o -o %t2 -shared --version-script %t.script -save-temps -; RUN: llvm-dis < %t2.lto.bc | FileCheck %s +; RUN: llvm-dis < %t2.0.2.internalize.bc | FileCheck %s target triple = "x86_64-unknown-linux-gnu" target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" diff --git a/test/ELF/lto/irmover-error.ll b/test/ELF/lto/irmover-error.ll index aee411441c47e..8b9836d23ca41 100644 --- a/test/ELF/lto/irmover-error.ll +++ b/test/ELF/lto/irmover-error.ll @@ -2,7 +2,7 @@ ; RUN: llvm-as -o %t2.bc %S/Inputs/irmover-error.ll ; RUN: not ld.lld -m elf_x86_64 %t1.bc %t2.bc -o %t 2>&1 | FileCheck %s -; CHECK: failed to link module {{.*}}2.bc: linking module flags 'foo': IDs have conflicting values +; CHECK: linking module flags 'foo': IDs have conflicting values target triple = "x86_64-unknown-linux-gnu" target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" diff --git a/test/ELF/lto/linkonce-odr.ll b/test/ELF/lto/linkonce-odr.ll index 569e271545459..44233513d1fb8 100644 --- a/test/ELF/lto/linkonce-odr.ll +++ b/test/ELF/lto/linkonce-odr.ll @@ -2,7 +2,7 @@ ; RUN: llvm-as %p/Inputs/linkonce-odr.ll -o %t1.o ; RUN: llc -relocation-model=pic %s -o %t2.o -filetype=obj ; RUN: ld.lld %t1.o %t2.o -o %t.so -shared -save-temps -; RUN: llvm-dis %t.so.lto.opt.bc -o - | FileCheck %s +; RUN: llvm-dis %t.so.0.4.opt.bc -o - | FileCheck %s target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" diff --git a/test/ELF/lto/linkonce.ll b/test/ELF/lto/linkonce.ll index f980eff887b19..6dba6a3fded7c 100644 --- a/test/ELF/lto/linkonce.ll +++ b/test/ELF/lto/linkonce.ll @@ -2,7 +2,7 @@ ; RUN: llvm-as %p/Inputs/linkonce.ll -o %t1.o ; RUN: llc -relocation-model=pic %s -o %t2.o -filetype=obj ; RUN: ld.lld %t1.o %t2.o -o %t.so -shared -save-temps -; RUN: llvm-dis %t.so.lto.opt.bc -o - | FileCheck %s +; RUN: llvm-dis %t.so.0.4.opt.bc -o - | FileCheck %s target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" diff --git a/test/ELF/lto/ltopasses-basic.ll b/test/ELF/lto/ltopasses-basic.ll index 5bd5f4122fd03..0c4ad8b9f17c6 100644 --- a/test/ELF/lto/ltopasses-basic.ll +++ b/test/ELF/lto/ltopasses-basic.ll @@ -1,8 +1,7 @@ ; REQUIRES: x86 -; RUN: rm -f %t.so.lto.bc %t.so.lto.opt.bc %t.so.lto.o ; RUN: llvm-as %s -o %t.o ; RUN: ld.lld -m elf_x86_64 %t.o -o %t.so -save-temps -mllvm -debug-pass=Arguments -shared 2>&1 | FileCheck %s --check-prefix=MLLVM -; RUN: llvm-dis %t.so.lto.opt.bc -o - | FileCheck %s +; RUN: llvm-dis %t.so.0.4.opt.bc -o - | FileCheck %s target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" diff --git a/test/ELF/lto/ltopasses-custom.ll b/test/ELF/lto/ltopasses-custom.ll index 3e982e079fb19..a48959a329913 100644 --- a/test/ELF/lto/ltopasses-custom.ll +++ b/test/ELF/lto/ltopasses-custom.ll @@ -3,8 +3,8 @@ ; RUN: ld.lld -m elf_x86_64 %t.o -o %t.so -save-temps --lto-aa-pipeline=basic-aa \ ; RUN: --lto-newpm-passes=ipsccp -shared ; RUN: ld.lld -m elf_x86_64 %t.o -o %t2.so -save-temps --lto-newpm-passes=loweratomic -shared -; RUN: llvm-dis %t.so.lto.opt.bc -o - | FileCheck %s -; RUN: llvm-dis %t2.so.lto.opt.bc -o - | FileCheck %s --check-prefix=ATOMIC +; RUN: llvm-dis %t.so.0.4.opt.bc -o - | FileCheck %s +; RUN: llvm-dis %t2.so.0.4.opt.bc -o - | FileCheck %s --check-prefix=ATOMIC target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" @@ -28,3 +28,10 @@ define void @barrier() { ; RUN: --lto-newpm-passes=iamnotapass -shared 2>&1 | \ ; RUN: FileCheck %s --check-prefix=INVALID ; INVALID: unable to parse pass pipeline description: iamnotapass + +; Check that invalid AA pipelines are rejected gracefully. +; RUN: not ld.lld -m elf_x86_64 %t.o -o %t2.so \ +; RUN: --lto-newpm-passes=globaldce --lto-aa-pipeline=patatino \ +; RUN: -shared 2>&1 | \ +; RUN: FileCheck %s --check-prefix=INVALIDAA +; INVALIDAA: unable to parse AA pipeline description: patatino diff --git a/test/ELF/lto/metadata.ll b/test/ELF/lto/metadata.ll index 3e73de5aab473..2eaacaae27265 100644 --- a/test/ELF/lto/metadata.ll +++ b/test/ELF/lto/metadata.ll @@ -10,4 +10,6 @@ define weak void @foo(i32* %p) { ret void } -!0 = !{!"Simple C/C++ TBAA"} +!0 = !{!1, !1, i64 0} +!1 = !{!"int", !2} +!2 = !{!"Simple C/C++ TBAA"} diff --git a/test/ELF/lto/parallel-internalize.ll b/test/ELF/lto/parallel-internalize.ll index 58ed50eab894c..a7ee4b35877e0 100644 --- a/test/ELF/lto/parallel-internalize.ll +++ b/test/ELF/lto/parallel-internalize.ll @@ -1,6 +1,7 @@ ; REQUIRES: x86 ; RUN: llvm-as -o %t.bc %s -; RUN: ld.lld -m elf_x86_64 --lto-jobs=2 -save-temps -o %t %t.bc -e foo --lto-O0 +; RUN: ld.lld -m elf_x86_64 --lto-partitions=2 -save-temps -o %t %t.bc \ +; RUN: -e foo --lto-O0 ; RUN: llvm-readobj -t -dyn-symbols %t | FileCheck %s ; RUN: llvm-nm %t0.lto.o | FileCheck --check-prefix=CHECK0 %s ; RUN: llvm-nm %t1.lto.o | FileCheck --check-prefix=CHECK1 %s @@ -16,8 +17,8 @@ ; CHECK-NEXT: Section: Undefined (0x0) ; CHECK-NEXT: } ; CHECK-NEXT: Symbol { -; CHECK-NEXT: Name: bar (5) -; CHECK-NEXT: Value: 0x11010 +; CHECK-NEXT: Name: bar +; CHECK-NEXT: Value: 0x201010 ; CHECK-NEXT: Size: 8 ; CHECK-NEXT: Binding: Local (0x0) ; CHECK-NEXT: Type: Function (0x2) @@ -27,8 +28,8 @@ ; CHECK-NEXT: Section: .text (0x2) ; CHECK-NEXT: } ; CHECK-NEXT: Symbol { -; CHECK-NEXT: Name: foo (1) -; CHECK-NEXT: Value: 0x11000 +; CHECK-NEXT: Name: foo +; CHECK-NEXT: Value: 0x201000 ; CHECK-NEXT: Size: 8 ; CHECK-NEXT: Binding: Global (0x1) ; CHECK-NEXT: Type: Function (0x2) diff --git a/test/ELF/lto/parallel.ll b/test/ELF/lto/parallel.ll index 8ea62ef3ae086..c5d7ca4e2cf1a 100644 --- a/test/ELF/lto/parallel.ll +++ b/test/ELF/lto/parallel.ll @@ -1,6 +1,6 @@ ; REQUIRES: x86 ; RUN: llvm-as -o %t.bc %s -; RUN: ld.lld -m elf_x86_64 --lto-jobs=2 -save-temps -o %t %t.bc -shared +; RUN: ld.lld -m elf_x86_64 --lto-partitions=2 -save-temps -o %t %t.bc -shared ; RUN: llvm-nm %t0.lto.o | FileCheck --check-prefix=CHECK0 %s ; RUN: llvm-nm %t1.lto.o | FileCheck --check-prefix=CHECK1 %s diff --git a/test/ELF/lto/save-temps.ll b/test/ELF/lto/save-temps.ll index 0b0f939c53f15..f7af99ed40af4 100644 --- a/test/ELF/lto/save-temps.ll +++ b/test/ELF/lto/save-temps.ll @@ -5,9 +5,9 @@ ; RUN: llvm-as %p/Inputs/save-temps.ll -o %t2.o ; RUN: ld.lld -shared -m elf_x86_64 %t.o %t2.o -save-temps ; RUN: llvm-nm a.out | FileCheck %s -; RUN: llvm-nm a.out.lto.bc | FileCheck %s +; RUN: llvm-nm a.out.0.0.preopt.bc | FileCheck %s ; RUN: llvm-nm a.out.lto.o | FileCheck %s -; RUN: llvm-dis a.out.lto.bc +; RUN: llvm-dis a.out.0.0.preopt.bc target triple = "x86_64-unknown-linux-gnu" target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" diff --git a/test/ELF/lto/shlib-undefined.ll b/test/ELF/lto/shlib-undefined.ll index db60de8e21b29..0250ed761927d 100644 --- a/test/ELF/lto/shlib-undefined.ll +++ b/test/ELF/lto/shlib-undefined.ll @@ -7,7 +7,7 @@ ; RUN: llvm-readobj -dyn-symbols %t | FileCheck %s ; CHECK: Name: __progname@ -; CHECK-NEXT: Value: 0x11010 +; CHECK-NEXT: Value: 0x201010 ; CHECK-NEXT: Size: 1 ; CHECK-NEXT: Binding: Global (0x1) ; CHECK-NEXT: Type: Function diff --git a/test/ELF/lto/thin-archivecollision.ll b/test/ELF/lto/thin-archivecollision.ll new file mode 100644 index 0000000000000..4e07187f36a0a --- /dev/null +++ b/test/ELF/lto/thin-archivecollision.ll @@ -0,0 +1,29 @@ +; RUN: opt -module-summary %s -o %t.o +; RUN: opt -module-summary %p/Inputs/thin1.ll -o %t.coll.o +; RUN: llvm-ar rcs %t1.a %t.coll.o +; RUN: opt -module-summary %p/Inputs/thin2.ll -o %t.coll.o +; RUN: llvm-ar rcsc %t2.a %t.coll.o + +; RUN: ld.lld %t.o %t1.a %t2.a -o %t +; RUN: llvm-nm %t | FileCheck %s + +; Check we handle this case correctly even in presence of --whole-archive. +; RUN: ld.lld %t.o --whole-archive %t1.a %t2.a -o %t +; RUN: llvm-nm %t | FileCheck %s + +; CHECK: T _start +; CHECK: T blah +; CHECK: T foo + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-scei-ps4" + +define i32 @_start() { +entry: + %call = call i32 @foo(i32 23) + %call1 = call i32 @blah(i32 37) + ret i32 0 +} + +declare i32 @foo(i32) #1 +declare i32 @blah(i32) #1 diff --git a/test/ELF/lto/thinlto.ll b/test/ELF/lto/thinlto.ll new file mode 100644 index 0000000000000..160c83a18abf8 --- /dev/null +++ b/test/ELF/lto/thinlto.ll @@ -0,0 +1,35 @@ +; Basic ThinLTO tests. +; RUN: opt -module-summary %s -o %t.o +; RUN: opt -module-summary %p/Inputs/thinlto.ll -o %t2.o + +; First force single-threaded mode +; RUN: ld.lld -save-temps --thinlto-jobs=1 -shared %t.o %t2.o -o %t +; RUN: llvm-nm %t0.lto.o | FileCheck %s --check-prefix=NM1-SINGLE +; RUN: llvm-nm %t1.lto.o | FileCheck %s --check-prefix=NM2-SINGLE + +; NM1-SINGLE: T f +; NM2-SINGLE: T g + +; Next force multi-threaded mode +; RUN: ld.lld -save-temps --thinlto-jobs=2 -shared %t.o %t2.o -o %t2 +; RUN: llvm-nm %t20.lto.o | FileCheck %s --check-prefix=NM1 +; RUN: llvm-nm %t21.lto.o | FileCheck %s --check-prefix=NM2 + +; NM1: T f +; NM2: T g + +; Then check without --thinlto-jobs (which currently default to hardware_concurrency) +; We just check that we don't crash or fail (as it's not sure which tests are +; stable on the final output file itself. +; RUN: ld.lld -shared %t.o %t2.o -o %t2 + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +declare void @g(...) + +define void @f() { +entry: + call void (...) @g() + ret void +} diff --git a/test/ELF/lto/timepasses.ll b/test/ELF/lto/timepasses.ll new file mode 100644 index 0000000000000..5c893e6619455 --- /dev/null +++ b/test/ELF/lto/timepasses.ll @@ -0,0 +1,15 @@ +; We use lld -flavor gnu because llvm-lit will append --full-shutdown to +; the ld.lld invocation. +; REQUIRES: x86 +; RUN: llvm-as %s -o %t.o +; RUN: lld -flavor gnu %t.o -o %t.so -shared -mllvm -time-passes 2>&1 | FileCheck %s + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +define void @patatino() { + ret void +} + +; We should get the output of -time-passes even when --full-shutdown is not specified. +; CHECK: Total Execution Time diff --git a/test/ELF/lto/type-merge.ll b/test/ELF/lto/type-merge.ll index 98db53970b0c4..d6f196d7c3ba0 100644 --- a/test/ELF/lto/type-merge.ll +++ b/test/ELF/lto/type-merge.ll @@ -2,7 +2,7 @@ ; RUN: llvm-as %s -o %t.o ; RUN: llvm-as %p/Inputs/type-merge.ll -o %t2.o ; RUN: ld.lld -m elf_x86_64 %t.o %t2.o -o %t -shared -save-temps -; RUN: llvm-dis < %t.lto.bc | FileCheck %s +; RUN: llvm-dis < %t.0.0.preopt.bc | FileCheck %s target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" diff --git a/test/ELF/lto/type-merge2.ll b/test/ELF/lto/type-merge2.ll index f0931ddc9d5e5..45777a7e6a489 100644 --- a/test/ELF/lto/type-merge2.ll +++ b/test/ELF/lto/type-merge2.ll @@ -1,7 +1,7 @@ ; RUN: llvm-as %s -o %t.o ; RUN: llvm-as %p/Inputs/type-merge2.ll -o %t2.o ; RUN: ld.lld -m elf_x86_64 %t.o %t2.o -o %t.so -shared -save-temps -; RUN: llvm-dis %t.so.lto.bc -o - | FileCheck %s +; RUN: llvm-dis %t.so.0.0.preopt.bc -o - | FileCheck %s target triple = "x86_64-unknown-linux-gnu" target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" diff --git a/test/ELF/lto/undefined-puts.ll b/test/ELF/lto/undefined-puts.ll index 54fb32cef4a27..07b2b4ef64145 100644 --- a/test/ELF/lto/undefined-puts.ll +++ b/test/ELF/lto/undefined-puts.ll @@ -20,7 +20,7 @@ declare i32 @printf(i8*, ...) ; Check that puts symbol is present in the dynamic symbol table and ; there's a relocation for it. ; CHECK: Dynamic Relocations { -; CHECK-NEXT: 0x13018 R_X86_64_JUMP_SLOT puts 0x0 +; CHECK-NEXT: 0x203018 R_X86_64_JUMP_SLOT puts 0x0 ; CHECK-NEXT: } ; CHECK: DynamicSymbols [ diff --git a/test/ELF/lto/unnamed-addr-comdat.ll b/test/ELF/lto/unnamed-addr-comdat.ll index c8c36de88d4cc..ed48f3ba5e04e 100644 --- a/test/ELF/lto/unnamed-addr-comdat.ll +++ b/test/ELF/lto/unnamed-addr-comdat.ll @@ -1,6 +1,6 @@ ; RUN: llvm-as %s -o %t.o ; RUN: ld.lld -m elf_x86_64 %t.o %t.o -o %t.so -save-temps -shared -; RUN: llvm-dis %t.so.lto.bc -o - | FileCheck %s +; RUN: llvm-dis %t.so.0.2.internalize.bc -o - | FileCheck %s target triple = "x86_64-unknown-linux-gnu" target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" diff --git a/test/ELF/lto/unnamed-addr-drop.ll b/test/ELF/lto/unnamed-addr-drop.ll new file mode 100644 index 0000000000000..9142537fe57d8 --- /dev/null +++ b/test/ELF/lto/unnamed-addr-drop.ll @@ -0,0 +1,12 @@ +; RUN: llvm-as %s -o %t1.o +; RUN: llvm-as %S/Inputs/unnamed-addr-drop.ll -o %t2.o +; RUN: ld.lld -m elf_x86_64 %t1.o %t2.o -o %t.so -save-temps -shared +; RUN: llvm-dis %t.so.0.2.internalize.bc -o - | FileCheck %s + +target triple = "x86_64-unknown-linux-gnu" +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + +@foo = weak constant i32 41 + +; Check that unnamed_addr is dropped during the merge. +; CHECK: @foo = constant i32 42 diff --git a/test/ELF/lto/unnamed-addr-lib.ll b/test/ELF/lto/unnamed-addr-lib.ll index c1c31f84bc8eb..c2bc6016efd56 100644 --- a/test/ELF/lto/unnamed-addr-lib.ll +++ b/test/ELF/lto/unnamed-addr-lib.ll @@ -3,7 +3,7 @@ ; RUN: llvm-mc %p/Inputs/unnamed-addr-lib.s -o %t2.o -filetype=obj -triple=x86_64-pc-linux ; RUN: ld.lld %t2.o -shared -o %t2.so ; RUN: ld.lld -m elf_x86_64 %t.o %t2.so -o %t.so -save-temps -shared -; RUN: llvm-dis %t.so.lto.bc -o - | FileCheck %s +; RUN: llvm-dis %t.so.0.2.internalize.bc -o - | FileCheck %s ; This documents a small limitation of lld's internalization logic. We decide ; that bar should be in the symbol table because if it is it will preempt the diff --git a/test/ELF/lto/unnamed-addr.ll b/test/ELF/lto/unnamed-addr.ll index a2c0105fd85f5..6a6dd73dad861 100644 --- a/test/ELF/lto/unnamed-addr.ll +++ b/test/ELF/lto/unnamed-addr.ll @@ -1,6 +1,6 @@ ; RUN: llvm-as %s -o %t.o ; RUN: ld.lld -m elf_x86_64 %t.o -o %t.so -save-temps -shared -; RUN: llvm-dis %t.so.lto.opt.bc -o - | FileCheck %s +; RUN: llvm-dis %t.so.0.4.opt.bc -o - | FileCheck %s target triple = "x86_64-unknown-linux-gnu" target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" diff --git a/test/ELF/lto/version-script.ll b/test/ELF/lto/version-script.ll index 11a7f073ab511..c43b443ff749b 100644 --- a/test/ELF/lto/version-script.ll +++ b/test/ELF/lto/version-script.ll @@ -2,7 +2,7 @@ ; RUN: llvm-as %s -o %t.o ; RUN: echo "VERSION_1.0{ global: foo; local: *; }; VERSION_2.0{ global: bar; local: *; };" > %t.script ; RUN: ld.lld -m elf_x86_64 %t.o -o %t2 -shared --version-script %t.script -save-temps -; RUN: llvm-dis < %t2.lto.bc | FileCheck %s +; RUN: llvm-dis < %t2.0.0.preopt.bc | FileCheck %s ; RUN: llvm-readobj -V -dyn-symbols %t2 | FileCheck --check-prefix=DSO %s target triple = "x86_64-unknown-linux-gnu" |