• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; First ensure that the ThinLTO handling in the gold plugin handles
2; bitcode without summary sections gracefully.
3; RUN: llvm-as %s -o %t.o
4; RUN: llvm-as %p/Inputs/thinlto.ll -o %t2.o
5; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
6; RUN:    --plugin-opt=thinlto \
7; RUN:    --plugin-opt=thinlto-index-only \
8; RUN:    -shared %t.o %t2.o -o %t3
9; RUN: not test -e %t3
10; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
11; RUN:    --plugin-opt=thinlto \
12; RUN:    -shared %t.o %t2.o -o %t4
13; RUN: llvm-nm %t4 | FileCheck %s --check-prefix=NM
14
15; Next generate summary sections and test gold handling.
16; RUN: opt -module-summary %s -o %t.o
17; RUN: opt -module-summary %p/Inputs/thinlto.ll -o %t2.o
18
19; Ensure gold generates an index and not a binary if requested.
20; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
21; RUN:    --plugin-opt=thinlto \
22; RUN:    --plugin-opt=thinlto-index-only \
23; RUN:    -shared %t.o %t2.o -o %t3
24; RUN: llvm-bcanalyzer -dump %t.o.thinlto.bc | FileCheck %s --check-prefix=BACKEND1
25; RUN: llvm-bcanalyzer -dump %t2.o.thinlto.bc | FileCheck %s --check-prefix=BACKEND2
26; RUN: not test -e %t3
27
28; Ensure gold generates an index as well as a binary by default in ThinLTO mode.
29; First force single-threaded mode
30; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
31; RUN:    --plugin-opt=thinlto \
32; RUN:    --plugin-opt=jobs=1 \
33; RUN:    -shared %t.o %t2.o -o %t4
34; RUN: llvm-bcanalyzer -dump %t4.thinlto.bc | FileCheck %s --check-prefix=COMBINED
35; RUN: llvm-nm %t4 | FileCheck %s --check-prefix=NM
36
37; Next force multi-threaded mode
38; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
39; RUN:    --plugin-opt=thinlto \
40; RUN:    --plugin-opt=jobs=2 \
41; RUN:    -shared %t.o %t2.o -o %t4
42; RUN: llvm-bcanalyzer -dump %t4.thinlto.bc | FileCheck %s --check-prefix=COMBINED
43; RUN: llvm-nm %t4 | FileCheck %s --check-prefix=NM
44
45; Test --plugin-opt=obj-path to ensure unique object files generated.
46; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
47; RUN:    --plugin-opt=thinlto \
48; RUN:    --plugin-opt=jobs=2 \
49; RUN:    --plugin-opt=obj-path=%t5.o \
50; RUN:    -shared %t.o %t2.o -o %t4
51; RUN: llvm-nm %t5.o0 | FileCheck %s --check-prefix=NM2
52; RUN: llvm-nm %t5.o1 | FileCheck %s --check-prefix=NM2
53
54; NM: T f
55; NM2: T {{f|g}}
56
57; The backend index for this module contains summaries from itself and
58; Inputs/thinlto.ll, as it imports from the latter.
59; BACKEND1: <MODULE_STRTAB_BLOCK
60; BACKEND1-NEXT: <ENTRY {{.*}} record string = '{{.*}}/test/tools/gold/X86/Output/thinlto.ll.tmp{{.*}}.o'
61; BACKEND1-NEXT: <ENTRY {{.*}} record string = '{{.*}}/test/tools/gold/X86/Output/thinlto.ll.tmp{{.*}}.o'
62; BACKEND1-NEXT: </MODULE_STRTAB_BLOCK
63; BACKEND1-NEXT: <GLOBALVAL_SUMMARY_BLOCK
64; BACKEND1-NEXT: <VERSION
65; BACKEND1-NEXT: <COMBINED
66; BACKEND1-NEXT: <COMBINED
67; BACKEND1-NEXT: </GLOBALVAL_SUMMARY_BLOCK
68; BACKEND1-NEXT: <VALUE_SYMTAB
69; Check that the format is: op0=valueid, op1=offset, op2=funcguid,
70; where funcguid is the lower 64 bits of the function name MD5.
71; BACKEND1-NEXT: <COMBINED_ENTRY abbrevid={{[0-9]+}} op0={{1|2}} op1={{-3706093650706652785|-5300342847281564238}}
72; BACKEND1-NEXT: <COMBINED_ENTRY abbrevid={{[0-9]+}} op0={{1|2}} op1={{-3706093650706652785|-5300342847281564238}}
73; BACKEND1-NEXT: </VALUE_SYMTAB
74
75; The backend index for Input/thinlto.ll contains summaries from itself only,
76; as it does not import anything.
77; BACKEND2: <MODULE_STRTAB_BLOCK
78; BACKEND2-NEXT: <ENTRY {{.*}} record string = '{{.*}}/test/tools/gold/X86/Output/thinlto.ll.tmp2.o'
79; BACKEND2-NEXT: </MODULE_STRTAB_BLOCK
80; BACKEND2-NEXT: <GLOBALVAL_SUMMARY_BLOCK
81; BACKEND2-NEXT: <VERSION
82; BACKEND2-NEXT: <COMBINED
83; BACKEND2-NEXT: </GLOBALVAL_SUMMARY_BLOCK
84; BACKEND2-NEXT: <VALUE_SYMTAB
85; Check that the format is: op0=valueid, op1=offset, op2=funcguid,
86; where funcguid is the lower 64 bits of the function name MD5.
87; BACKEND2-NEXT: <COMBINED_ENTRY abbrevid={{[0-9]+}} op0=1 op1=-5300342847281564238
88; BACKEND2-NEXT: </VALUE_SYMTAB
89
90; COMBINED: <MODULE_STRTAB_BLOCK
91; COMBINED-NEXT: <ENTRY {{.*}} record string = '{{.*}}/test/tools/gold/X86/Output/thinlto.ll.tmp{{.*}}.o'
92; COMBINED-NEXT: <ENTRY {{.*}} record string = '{{.*}}/test/tools/gold/X86/Output/thinlto.ll.tmp{{.*}}.o'
93; COMBINED-NEXT: </MODULE_STRTAB_BLOCK
94; COMBINED-NEXT: <GLOBALVAL_SUMMARY_BLOCK
95; COMBINED-NEXT: <VERSION
96; COMBINED-NEXT: <COMBINED
97; COMBINED-NEXT: <COMBINED
98; COMBINED-NEXT: </GLOBALVAL_SUMMARY_BLOCK
99; COMBINED-NEXT: <VALUE_SYMTAB
100; Check that the format is: op0=valueid, op1=offset, op2=funcguid,
101; where funcguid is the lower 64 bits of the function name MD5.
102; COMBINED-NEXT: <COMBINED_ENTRY abbrevid={{[0-9]+}} op0={{1|2}} op1={{-3706093650706652785|-5300342847281564238}}
103; COMBINED-NEXT: <COMBINED_ENTRY abbrevid={{[0-9]+}} op0={{1|2}} op1={{-3706093650706652785|-5300342847281564238}}
104; COMBINED-NEXT: </VALUE_SYMTAB
105
106declare void @g(...)
107
108define void @f() {
109entry:
110  call void (...) @g()
111  ret void
112}
113