File: save-temps-eq.ll

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (124 lines) | stat: -rw-r--r-- 4,141 bytes parent folder | download | duplicates (5)
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
;; This test is similar to llvm/test/ThinLTO/X86/selective-save-temps.ll

; REQUIRES: x86
; UNSUPPORTED: system-windows
;; Unsupported on Windows due to difficulty with escaping "opt" across platforms.
;; lit substitutes 'opt' with /path/to/opt.

; RUN: rm -rf %t && mkdir %t && cd %t
; RUN: mkdir all all2 all3 build subset subset2 && cd build

; RUN: opt -thinlto-bc -o main.o %s
; RUN: opt -thinlto-bc -o thin1.o %S/Inputs/thinlto.ll

;; Create the .all dir with save-temps saving everything, this will be used to compare
;; with the output from individualized save-temps later
; RUN: ld.lld main.o thin1.o --save-temps -o %t/all/a.out
; RUN: mv *.o.* %t/all
;; Sanity check that everything got moved
; RUN: ls | count 2

;; Check precedence if both --save-temps and --save-temps= are present
; RUN: ld.lld main.o thin1.o --save-temps=preopt --save-temps --save-temps=\opt -o %t/all2/a.out
; RUN: cmp %t/all2/a.out %t/all/a.out
; RUN: mv *.o.* %t/all2
; RUN: ls | count 2
; RUN: diff -r %t/all %t/all2

;; The next 9 blocks follow this structure:
;; for each option of save-temps=
;;   Run linker and generate files
;;   Make sure a.out exists and is correct (by diff-ing)
;;     this is the only file that should recur between runs
;;   (Also, for some stages, copy the generated files to %t/subset2 to check composability later)
;;   Move files that were expected to be generated to %t/all3
;;   Make sure there's no unexpected extra files
;; After that, we'll diff %t/all and %t/all3 to make sure all contents are identical

;; Check preopt
; RUN: ld.lld main.o thin1.o --save-temps=preopt
; RUN: cmp %t/all/a.out a.out && rm -f a.out
; RUN: cp *.0.preopt.* %t/subset2
; RUN: mv *.0.preopt.* %t/all3
; RUN: ls | count 2

;; Check promote
; RUN: ld.lld main.o thin1.o --save-temps=promote
; RUN: cmp %t/all/a.out a.out && rm -f a.out
; RUN: mv *.1.promote* %t/all3
; RUN: ls | count 2

;; Check internalize
; RUN: ld.lld main.o thin1.o --save-temps=internalize
; RUN: cmp %t/all/a.out a.out && rm -f a.out
; RUN: mv *.2.internalize* %t/all3
; RUN: ls | count 2

;; Check import
; RUN: ld.lld main.o thin1.o --save-temps=import
; RUN: cmp %t/all/a.out a.out && rm -f a.out
; RUN: mv *.3.import* %t/all3
; RUN: ls | count 2

;; Check opt
; RUN: ld.lld main.o thin1.o --save-temps=\opt
; RUN: cmp %t/all/a.out a.out && rm -f a.out
; RUN: cp *.4.opt* %t/subset2
; RUN: mv *.4.opt* %t/all3
; RUN: ls | count 2

;; Check precodegen
; RUN: ld.lld main.o thin1.o --save-temps=precodegen
; RUN: cmp %t/all/a.out a.out && rm -f a.out
; RUN: mv *.5.precodegen* %t/all3
; RUN: ls | count 2

;; Check combinedindex
; RUN: ld.lld main.o thin1.o --save-temps=combinedindex
; RUN: cmp %t/all/a.out a.out && rm -f a.out
; RUN: mv *.index.bc %t/all3
; RUN: mv *.index.dot %t/all3
; RUN: ls | count 2

;; Check prelink
; RUN: ld.lld main.o thin1.o --save-temps=prelink
; RUN: cmp %t/all/a.out a.out && rm -f a.out
; RUN: cp *.lto.o %t/subset2
; RUN: mv *.lto.o %t/all3
; RUN: ls | count 2

;; Check resolution
; RUN: ld.lld main.o thin1.o --save-temps=resolution
;; %t/all3 needs at least 1 copy of a.out, move it over now since its the last block
; RUN: mv a.out %t/all3
; RUN: mv *.resolution.txt %t/all3
; RUN: ls | count 2

;; If no files were left out from individual stages, the .all3 dir should be identical to .all
; RUN: diff -r %t/all %t/all3

;; Check multi-stage composability
;; Similar to the above, but do it with a subset instead.
;; .all -> .subset, .all3 -> .subset2
; RUN: ld.lld main.o thin1.o --save-temps=preopt --save-temps=prelink --save-temps=\opt
; RUN: cmp %t/all/a.out a.out && rm -f a.out
; RUN: mv *.0.preopt.* %t/subset
; RUN: mv *.4.opt* %t/subset
; RUN: mv *.lto.o %t/subset
; RUN: ls | count 2
; RUN: diff -r %t/subset2 %t/subset

;; Check error message
; RUN: not ld.lld --save-temps=prelink --save-temps=\opt --save-temps=notastage 2>&1 \
; RUN: | FileCheck %s
; CHECK: unknown --save-temps value: notastage

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

declare void @g()

define i32 @_start() {
  call void @g()
  ret i32 0
}