1; REQUIRES: x86
2
3; Basic ThinLTO tests.
4; RUN: opt -thinlto-bc %s -o %t1.obj
5; RUN: opt -thinlto-bc %p/Inputs/thinlto.ll -o %t2.obj
6; RUN: opt -thinlto-bc %p/Inputs/thinlto-empty.ll -o %t3.obj
7
8; Ensure lld generates an index and not a binary if requested.
9; RUN: rm -f %t4.exe
10; RUN: lld-link -thinlto-index-only -entry:main %t1.obj %t2.obj -out:%t4.exe
11; RUN: llvm-bcanalyzer -dump %t1.obj.thinlto.bc | FileCheck %s --check-prefix=BACKEND1
12; RUN: llvm-bcanalyzer -dump %t2.obj.thinlto.bc | FileCheck %s --check-prefix=BACKEND2
13; RUN: not test -e %t4.exe
14
15; The backend index for this module contains summaries from itself and
16; Inputs/thinlto.ll, as it imports from the latter.
17; BACKEND1: <MODULE_STRTAB_BLOCK
18; BACKEND1-NEXT: <ENTRY {{.*}} record string = '{{.*}}thinlto-index-only.ll.tmp{{.*}}.obj'
19; BACKEND1: <ENTRY {{.*}} record string = '{{.*}}thinlto-index-only.ll.tmp{{.*}}.obj'
20; BACKEND1-NOT: <ENTRY
21; BACKEND1: </MODULE_STRTAB_BLOCK
22; BACKEND1: <GLOBALVAL_SUMMARY_BLOCK
23; BACKEND1: <VERSION
24; BACKEND1: <FLAGS
25; BACKEND1: <VALUE_GUID op0={{1|2}} op1={{-5300342847281564238|-2624081020897602054}}
26; BACKEND1: <VALUE_GUID op0={{1|2}} op1={{-5300342847281564238|-2624081020897602054}}
27; BACKEND1: <COMBINED
28; BACKEND1: <COMBINED
29; BACKEND1: </GLOBALVAL_SUMMARY_BLOCK
30
31; The backend index for Input/thinlto.ll contains summaries from itself only,
32; as it does not import anything.
33; BACKEND2: <MODULE_STRTAB_BLOCK
34; BACKEND2-NEXT: <ENTRY {{.*}} record string = '{{.*}}thinlto-index-only.ll.tmp2.obj'
35; BACKEND2-NOT: <ENTRY
36; BACKEND2: </MODULE_STRTAB_BLOCK
37; BACKEND2-NEXT: <GLOBALVAL_SUMMARY_BLOCK
38; BACKEND2-NEXT: <VERSION
39; BACKEND2-NEXT: <FLAGS
40; BACKEND2-NEXT: <VALUE_GUID op0=1 op1=-5300342847281564238
41; BACKEND2-NEXT: <COMBINED
42; BACKEND2-NEXT: </GLOBALVAL_SUMMARY_BLOCK
43
44target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
45target triple = "x86_64-pc-windows-msvc19.0.24215"
46
47declare void @g(...)
48
49define void @main() {
50  call void (...) @g()
51  ret void
52}
53