|
1 | 1 | ; REQUIRES: x86
|
| 2 | +; RUN: rm -rf %t && mkdir %t && cd %t |
2 | 3 |
|
3 |
| -; First ensure that the ThinLTO handling in lld handles |
4 |
| -; bitcode without summary sections gracefully and generates index file. |
5 |
| -; RUN: llvm-as %s -o %t1.o |
6 |
| -; RUN: llvm-as %p/Inputs/thinlto.ll -o %t2.o |
7 |
| -; RUN: rm -f %t3 |
8 |
| -; RUN: ld.lld --plugin-opt=thinlto-index-only -shared %t1.o %t2.o -o %t3 |
9 |
| -; RUN: ls %t2.o.thinlto.bc |
10 |
| -; RUN: not test -e %t3 |
11 |
| -; RUN: ld.lld -shared %t1.o %t2.o -o %t3 |
12 |
| -; RUN: llvm-nm %t3 | FileCheck %s --check-prefix=NM |
| 4 | +;; First ensure that the ThinLTO handling in lld handles |
| 5 | +;; bitcode without summary sections gracefully and generates index file. |
| 6 | +; RUN: llvm-as %s -o 1.o |
| 7 | +; RUN: llvm-as %p/Inputs/thinlto.ll -o 2.o |
| 8 | +; RUN: ld.lld --plugin-opt=thinlto-index-only -shared 1.o 2.o -o 3 |
| 9 | +; RUN: ls 2.o.thinlto.bc |
| 10 | +; RUN: not test -e 3 |
| 11 | +; RUN: ld.lld -shared 1.o 2.o -o 3 |
| 12 | +; RUN: llvm-nm 3 | FileCheck %s --check-prefix=NM |
13 | 13 |
|
14 |
| -; Basic ThinLTO tests. |
15 |
| -; RUN: opt -module-summary %s -o %t1.o |
16 |
| -; RUN: opt -module-summary %p/Inputs/thinlto.ll -o %t2.o |
17 |
| -; RUN: opt -module-summary %p/Inputs/thinlto_empty.ll -o %t3.o |
| 14 | +;; Basic ThinLTO tests. |
| 15 | +; RUN: opt -module-summary %s -o 1.o |
| 16 | +; RUN: opt -module-summary %p/Inputs/thinlto.ll -o 2.o |
| 17 | +; RUN: opt -module-summary %p/Inputs/thinlto_empty.ll -o 3.o |
18 | 18 |
|
19 |
| -; Ensure lld generates an index and not a binary if requested. |
20 |
| -; RUN: rm -f %t4 |
21 |
| -; RUN: ld.lld --plugin-opt=thinlto-index-only -shared %t1.o %t2.o -o %t4 |
22 |
| -; RUN: llvm-bcanalyzer -dump %t1.o.thinlto.bc | FileCheck %s --check-prefix=BACKEND1 |
23 |
| -; RUN: llvm-bcanalyzer -dump %t2.o.thinlto.bc | FileCheck %s --check-prefix=BACKEND2 |
24 |
| -; RUN: not test -e %t4 |
| 19 | +;; Ensure lld generates an index and not a binary if requested. |
| 20 | +; RUN: ld.lld --plugin-opt=thinlto-index-only -shared 1.o 2.o -o 4 |
| 21 | +; RUN: llvm-bcanalyzer -dump 1.o.thinlto.bc | FileCheck %s --check-prefix=BACKEND1 |
| 22 | +; RUN: llvm-bcanalyzer -dump 2.o.thinlto.bc | FileCheck %s --check-prefix=BACKEND2 |
| 23 | +; RUN: not test -e 4 |
25 | 24 |
|
26 |
| -; Ensure lld generates an index even if the file is wrapped in --start-lib/--end-lib |
27 |
| -; RUN: rm -f %t2.o.thinlto.bc %t4 |
28 |
| -; RUN: ld.lld --plugin-opt=thinlto-index-only -shared %t1.o %t3.o --start-lib %t2.o --end-lib -o %t4 |
29 |
| -; RUN: llvm-dis < %t2.o.thinlto.bc | grep -q '\^0 = module:' |
30 |
| -; RUN: not test -e %t4 |
| 25 | +;; Ensure lld generates an index even if the file is wrapped in --start-lib/--end-lib |
| 26 | +; RUN: rm -f 2.o.thinlto.bc 4 |
| 27 | +; RUN: ld.lld --plugin-opt=thinlto-index-only -shared 1.o 3.o --start-lib 2.o --end-lib -o 4 |
| 28 | +; RUN: llvm-dis < 2.o.thinlto.bc | grep -q '\^0 = module:' |
| 29 | +; RUN: not test -e 4 |
31 | 30 |
|
32 |
| -; Test that LLD generates an empty index even for lazy object file that is not added to link. |
33 |
| -; Test LLD generates empty imports file either because of thinlto-emit-imports-files option. |
34 |
| -; RUN: rm -f %t1.o.thinlto.bc |
35 |
| -; RUN: rm -f %t1.o.imports |
36 |
| -; RUN: ld.lld --plugin-opt=thinlto-index-only -shared %t2.o --start-lib %t1.o --end-lib \ |
37 |
| -; RUN: --plugin-opt=thinlto-emit-imports-files -o %t3 |
38 |
| -; RUN: ls %t1.o.thinlto.bc |
39 |
| -; RUN: ls %t1.o.imports |
| 31 | +;; Test that LLD generates an empty index even for lazy object file that is not added to link. |
| 32 | +;; Test LLD generates empty imports file either because of thinlto-emit-imports-files option. |
| 33 | +; RUN: rm -f 1.o.thinlto.bc 1.o.imports |
| 34 | +; RUN: ld.lld --plugin-opt=thinlto-index-only -shared 2.o --start-lib 1.o --end-lib \ |
| 35 | +; RUN: --plugin-opt=thinlto-emit-imports-files -o 3 |
| 36 | +; RUN: ls 1.o.thinlto.bc |
| 37 | +; RUN: ls 1.o.imports |
40 | 38 |
|
41 |
| -; Ensure LLD generates an empty index for each bitcode file even if all bitcode files are lazy. |
42 |
| -; RUN: rm -f %t1.o.thinlto.bc |
43 |
| -; RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux-gnu /dev/null -o %tdummy.o |
44 |
| -; RUN: ld.lld --plugin-opt=thinlto-index-only -shared %tdummy.o --start-lib %t1.o --end-lib -o /dev/null |
45 |
| -; RUN: ls %t1.o.thinlto.bc |
| 39 | +;; Ensure LLD generates an empty index for each bitcode file even if all bitcode files are lazy. |
| 40 | +; RUN: rm -f 1.o.thinlto.bc |
| 41 | +; RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux-gnu /dev/null -o dummy.o |
| 42 | +; RUN: ld.lld --plugin-opt=thinlto-index-only -shared dummy.o --start-lib 1.o --end-lib -o /dev/null |
| 43 | +; RUN: ls 1.o.thinlto.bc |
46 | 44 |
|
47 | 45 | ; NM: T f
|
48 | 46 |
|
49 |
| -; The backend index for this module contains summaries from itself and |
50 |
| -; Inputs/thinlto.ll, as it imports from the latter. |
| 47 | +;; The backend index for this module contains summaries from itself and |
| 48 | +;; Inputs/thinlto.ll, as it imports from the latter. |
51 | 49 | ; BACKEND1: <MODULE_STRTAB_BLOCK
|
52 |
| -; BACKEND1-NEXT: <ENTRY {{.*}} record string = '{{.*}}thinlto-index-only.ll.tmp{{.*}}.o' |
53 |
| -; BACKEND1-NEXT: <ENTRY {{.*}} record string = '{{.*}}thinlto-index-only.ll.tmp{{.*}}.o' |
| 50 | +; BACKEND1-NEXT: <ENTRY {{.*}} record string = '1.o' |
| 51 | +; BACKEND1-NEXT: <ENTRY {{.*}} record string = '2.o' |
54 | 52 | ; BACKEND1-NEXT: </MODULE_STRTAB_BLOCK
|
55 | 53 | ; BACKEND1: <GLOBALVAL_SUMMARY_BLOCK
|
56 | 54 | ; BACKEND1: <VERSION
|
|
61 | 59 | ; BACKEND1: <COMBINED
|
62 | 60 | ; BACKEND1: </GLOBALVAL_SUMMARY_BLOCK
|
63 | 61 |
|
64 |
| -; The backend index for Input/thinlto.ll contains summaries from itself only, |
65 |
| -; as it does not import anything. |
| 62 | +;; The backend index for Input/thinlto.ll contains summaries from itself only, |
| 63 | +;; as it does not import anything. |
66 | 64 | ; BACKEND2: <MODULE_STRTAB_BLOCK
|
67 |
| -; BACKEND2-NEXT: <ENTRY {{.*}} record string = '{{.*}}thinlto-index-only.ll.tmp2.o' |
| 65 | +; BACKEND2-NEXT: <ENTRY {{.*}} record string = '2.o' |
68 | 66 | ; BACKEND2-NEXT: </MODULE_STRTAB_BLOCK
|
69 | 67 | ; BACKEND2-NEXT: <GLOBALVAL_SUMMARY_BLOCK
|
70 | 68 | ; BACKEND2-NEXT: <VERSION
|
|
0 commit comments