File: emit-inprocess-files.ll

package info (click to toggle)
llvm-toolchain-15 1%3A15.0.6-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,554,644 kB
  • sloc: cpp: 5,922,452; ansic: 1,012,136; asm: 674,362; python: 191,568; objc: 73,855; f90: 42,327; lisp: 31,913; pascal: 11,973; javascript: 10,144; sh: 9,421; perl: 7,447; ml: 5,527; awk: 3,523; makefile: 2,520; xml: 885; cs: 573; fortran: 567
file content (87 lines) | stat: -rw-r--r-- 2,965 bytes parent folder | download | duplicates (13)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
; Test InProcessThinLTO thin link output from llvm-lto2
; Partially copied from distributed_import.ll, and added checks for {dis|en}abling imports

; RUN: rm -f %t1.bc.thinlto.bc %t2.bc.thinlto.bc %t.out.1 %t.out.2 %t1.bc.imports %t2.bc.imports

; Generate bitcode files with summary, as well as minimized bitcode containing just the summary
; RUN: opt -thinlto-bc %s -thin-link-bitcode-file=%t1.thinlink.bc -o %t1.bc
; RUN: opt -thinlto-bc %p/Inputs/distributed_import.ll -thin-link-bitcode-file=%t2.thinlink.bc -o %t2.bc

; First perform the thin link on the normal bitcode file using
; -thinlto-distributed-indexes, collecting outputs to be compared with later.
; RUN: llvm-lto2 run %t1.bc %t2.bc -o %t.o -save-temps \
; RUN:     -thinlto-distributed-indexes \
; RUN:     -thinlto-emit-imports \
; RUN:     -r=%t1.bc,g, \
; RUN:     -r=%t1.bc,analias, \
; RUN:     -r=%t1.bc,f,px \
; RUN:     -r=%t2.bc,g,px \
; RUN:     -r=%t2.bc,analias,px \
; RUN:     -r=%t2.bc,aliasee,px
; RUN: mv %t1.bc.thinlto.bc %t1.bc.thinlto.bc.orig
; RUN: mv %t2.bc.thinlto.bc %t2.bc.thinlto.bc.orig
; RUN: mv %t1.bc.imports %t1.bc.imports.orig
; RUN: mv %t2.bc.imports %t2.bc.imports.orig

; Now use -thinlto-emit-indexes instead.
; RUN: llvm-lto2 run %t1.bc %t2.bc -o %t.o -save-temps \
; RUN:     -thinlto-emit-indexes \
; RUN:     -r=%t1.bc,g, \
; RUN:     -r=%t1.bc,analias, \
; RUN:     -r=%t1.bc,f,px \
; RUN:     -r=%t2.bc,g,px \
; RUN:     -r=%t2.bc,analias,px \
; RUN:     -r=%t2.bc,aliasee,px \
; RUN:     -o=%t.out

; Since InProcessThinLTO ran, there should be output
; RUN: ls %t.out.1
; RUN: ls %t.out.2

; Ensure imports weren't generated since -thinlto-emit-imports wasn't specified
; RUN: not ls %t1.bc.imports
; RUN: not ls %t2.bc.imports

; Compare the generated index files.
; RUN: diff %t1.bc.thinlto.bc %t1.bc.thinlto.bc.orig
; RUN: diff %t2.bc.thinlto.bc %t2.bc.thinlto.bc.orig

; RUN: rm -f %t1.bc.thinlto.bc %t2.bc.thinlto.bc %t.out.1 %t.out.2

; Do the thin link again but also emit imports files now
; RUN: llvm-lto2 run %t1.bc %t2.bc -o %t.o -save-temps \
; RUN:     -thinlto-emit-indexes \
; RUN:     -thinlto-emit-imports \
; RUN:     -r=%t1.bc,g, \
; RUN:     -r=%t1.bc,analias, \
; RUN:     -r=%t1.bc,f,px \
; RUN:     -r=%t2.bc,g,px \
; RUN:     -r=%t2.bc,analias,px \
; RUN:     -r=%t2.bc,aliasee,px \
; RUN:     -o=%t.out

; Check the output
; RUN: ls %t.out.1
; RUN: ls %t.out.2
; RUN: diff %t1.bc.thinlto.bc %t1.bc.thinlto.bc.orig
; RUN: diff %t2.bc.thinlto.bc %t2.bc.thinlto.bc.orig
; RUN: diff %t1.bc.imports %t1.bc.imports.orig
; RUN: diff %t2.bc.imports %t2.bc.imports.orig

target triple = "x86_64-unknown-linux-gnu"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"

declare i32 @g(...)
declare void @analias(...)

define void @f() {
entry:
  call i32 (...) @g()
  call void (...) @analias()
  ret void
}

!llvm.dbg.cu = !{}

!1 = !{i32 2, !"Debug Info Version", i32 3}
!llvm.module.flags = !{!1}