annotate llvm/test/ThinLTO/X86/cache.ll @ 206:f17a3b42b08b

Added tag before-12 for changeset b7591485f4cd
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 07 Jun 2021 21:25:57 +0900
parents 1d019706d866
children 2e18cbf3894f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 ; NetBSD: noatime mounts currently inhibit 'touch -a' updates
anatofuz
parents:
diff changeset
2 ; UNSUPPORTED: system-netbsd
anatofuz
parents:
diff changeset
3
anatofuz
parents:
diff changeset
4 ; Verify first that *without* hash, we don't use the cache.
anatofuz
parents:
diff changeset
5 ; RUN: opt -module-summary %s -o %t.bc
anatofuz
parents:
diff changeset
6 ; RUN: opt -module-summary %p/Inputs/cache.ll -o %t2.bc
anatofuz
parents:
diff changeset
7
anatofuz
parents:
diff changeset
8 ; Verify that enabling caching is ignoring module without hash
anatofuz
parents:
diff changeset
9 ; RUN: rm -Rf %t.cache && mkdir %t.cache
anatofuz
parents:
diff changeset
10 ; RUN: llvm-lto -thinlto-action=run -exported-symbol=globalfunc %t2.bc %t.bc -thinlto-cache-dir %t.cache
anatofuz
parents:
diff changeset
11 ; RUN: ls %t.cache/llvmcache.timestamp
anatofuz
parents:
diff changeset
12 ; RUN: ls %t.cache | count 1
anatofuz
parents:
diff changeset
13
anatofuz
parents:
diff changeset
14 ; Verify that enabling caching is ignoring module without hash with llvm-lto2
anatofuz
parents:
diff changeset
15 ; RUN: rm -Rf %t.cache
anatofuz
parents:
diff changeset
16 ; RUN: llvm-lto2 run -o %t.o %t2.bc %t.bc -cache-dir %t.cache \
anatofuz
parents:
diff changeset
17 ; RUN: -r=%t2.bc,_main,plx \
anatofuz
parents:
diff changeset
18 ; RUN: -r=%t2.bc,_globalfunc,lx \
anatofuz
parents:
diff changeset
19 ; RUN: -r=%t.bc,_globalfunc,plx
anatofuz
parents:
diff changeset
20 ; RUN: ls %t.cache | count 0
anatofuz
parents:
diff changeset
21
anatofuz
parents:
diff changeset
22
anatofuz
parents:
diff changeset
23 ; Repeat again, *with* hash this time.
anatofuz
parents:
diff changeset
24
anatofuz
parents:
diff changeset
25 ; RUN: opt -module-hash -module-summary %s -o %t.bc
anatofuz
parents:
diff changeset
26 ; RUN: opt -module-hash -module-summary %p/Inputs/cache.ll -o %t2.bc
anatofuz
parents:
diff changeset
27
anatofuz
parents:
diff changeset
28 ; Verify that enabling caching is working, and that the pruner only removes
anatofuz
parents:
diff changeset
29 ; files matching the pattern "llvmcache-*".
anatofuz
parents:
diff changeset
30 ; RUN: rm -Rf %t.cache && mkdir %t.cache
anatofuz
parents:
diff changeset
31 ; RUN: touch -t 197001011200 %t.cache/llvmcache-foo %t.cache/foo
anatofuz
parents:
diff changeset
32 ; RUN: llvm-lto -thinlto-action=run -exported-symbol=globalfunc %t2.bc %t.bc -thinlto-cache-dir %t.cache
anatofuz
parents:
diff changeset
33 ; RUN: ls %t.cache | count 4
anatofuz
parents:
diff changeset
34 ; RUN: ls %t.cache/llvmcache.timestamp
anatofuz
parents:
diff changeset
35 ; RUN: ls %t.cache/foo
anatofuz
parents:
diff changeset
36 ; RUN: not ls %t.cache/llvmcache-foo
anatofuz
parents:
diff changeset
37 ; RUN: ls %t.cache/llvmcache-* | count 2
anatofuz
parents:
diff changeset
38
anatofuz
parents:
diff changeset
39 ; Verify that enabling caching is working with llvm-lto2
anatofuz
parents:
diff changeset
40 ; RUN: rm -Rf %t.cache
anatofuz
parents:
diff changeset
41 ; RUN: llvm-lto2 run -o %t.o %t2.bc %t.bc -cache-dir %t.cache \
anatofuz
parents:
diff changeset
42 ; RUN: -r=%t2.bc,_main,plx \
anatofuz
parents:
diff changeset
43 ; RUN: -r=%t2.bc,_globalfunc,lx \
anatofuz
parents:
diff changeset
44 ; RUN: -r=%t.bc,_globalfunc,plx
anatofuz
parents:
diff changeset
45 ; RUN: ls %t.cache | count 2
anatofuz
parents:
diff changeset
46 ; RUN: ls %t.cache/llvmcache-* | count 2
anatofuz
parents:
diff changeset
47
anatofuz
parents:
diff changeset
48 ; Verify that caches with a timestamp older than the pruning interval
anatofuz
parents:
diff changeset
49 ; will be pruned
anatofuz
parents:
diff changeset
50 ; RUN: rm -Rf %t.cache && mkdir %t.cache
anatofuz
parents:
diff changeset
51 ; RUN: touch -t 197001011200 %t.cache/llvmcache-foo
anatofuz
parents:
diff changeset
52 ; RUN: touch -t 197001011200 %t.cache/llvmcache.timestamp
anatofuz
parents:
diff changeset
53 ; RUN: llvm-lto -thinlto-action=run -exported-symbol=globalfunc %t2.bc %t.bc -thinlto-cache-dir %t.cache
anatofuz
parents:
diff changeset
54 ; RUN: not ls %t.cache/llvmcache-foo
anatofuz
parents:
diff changeset
55
anatofuz
parents:
diff changeset
56 ; Verify that specifying a negative number for the pruning interval
anatofuz
parents:
diff changeset
57 ; effectively disables the pruning
anatofuz
parents:
diff changeset
58 ; RUN: rm -Rf %t.cache && mkdir %t.cache
anatofuz
parents:
diff changeset
59 ; RUN: touch -t 197001011200 %t.cache/llvmcache-foo
anatofuz
parents:
diff changeset
60 ; RUN: touch -t 197001011200 %t.cache/llvmcache.timestamp
anatofuz
parents:
diff changeset
61 ; RUN: llvm-lto -thinlto-action=run -exported-symbol=globalfunc %t2.bc %t.bc -thinlto-cache-dir %t.cache --thinlto-cache-pruning-interval -1
anatofuz
parents:
diff changeset
62 ; RUN: ls %t.cache/llvmcache-foo
anatofuz
parents:
diff changeset
63
anatofuz
parents:
diff changeset
64 ; Verify that the pruner doesn't run and a cache file is not deleted when:
anatofuz
parents:
diff changeset
65 ; default values for pruning interval and cache expiration are used,
anatofuz
parents:
diff changeset
66 ; llvmcache.timestamp is current,
anatofuz
parents:
diff changeset
67 ; cache file is older than default cache expiration value.
anatofuz
parents:
diff changeset
68 ; RUN: rm -Rf %t.cache && mkdir %t.cache
anatofuz
parents:
diff changeset
69 ; RUN: touch -t 197001011200 %t.cache/llvmcache-foo
anatofuz
parents:
diff changeset
70 ; RUN: touch %t.cache/llvmcache.timestamp
anatofuz
parents:
diff changeset
71 ; RUN: llvm-lto -thinlto-action=run -exported-symbol=globalfunc %t2.bc %t.bc -thinlto-cache-dir %t.cache
anatofuz
parents:
diff changeset
72 ; RUN: ls %t.cache/llvmcache-foo
anatofuz
parents:
diff changeset
73
anatofuz
parents:
diff changeset
74 ; Verify that the pruner runs and a cache file is deleted when:
anatofuz
parents:
diff changeset
75 ; pruning interval has value 0 (i.e. run garbage collector now)
anatofuz
parents:
diff changeset
76 ; default value for cache expiration is used,
anatofuz
parents:
diff changeset
77 ; llvmcache.timestamp is current,
anatofuz
parents:
diff changeset
78 ; cache file is older than default cache expiration value.
anatofuz
parents:
diff changeset
79 ; RUN: rm -Rf %t.cache && mkdir %t.cache
anatofuz
parents:
diff changeset
80 ; RUN: touch -t 197001011200 %t.cache/llvmcache-foo
anatofuz
parents:
diff changeset
81 ; RUN: touch %t.cache/llvmcache.timestamp
anatofuz
parents:
diff changeset
82 ; RUN: llvm-lto -thinlto-action=run -exported-symbol=globalfunc %t2.bc %t.bc -thinlto-cache-dir %t.cache --thinlto-cache-pruning-interval 0
anatofuz
parents:
diff changeset
83 ; RUN: not ls %t.cache/llvmcache-foo
anatofuz
parents:
diff changeset
84
anatofuz
parents:
diff changeset
85 ; Populate the cache with files with "old" access times, then check llvm-lto updates these file times
anatofuz
parents:
diff changeset
86 ; A negative pruning interval is used to avoid removing cache entries
anatofuz
parents:
diff changeset
87 ; RUN: rm -Rf %t.cache && mkdir %t.cache
anatofuz
parents:
diff changeset
88 ; RUN: llvm-lto -thinlto-action=run -exported-symbol=globalfunc %t2.bc %t.bc -thinlto-cache-dir %t.cache
anatofuz
parents:
diff changeset
89 ; RUN: touch -a -t 197001011200 %t.cache/llvmcache-*
anatofuz
parents:
diff changeset
90 ; RUN: llvm-lto -thinlto-action=run -exported-symbol=globalfunc %t2.bc %t.bc -thinlto-cache-dir %t.cache --thinlto-cache-pruning-interval -1
anatofuz
parents:
diff changeset
91 ; RUN: ls -ltu %t.cache/* | not grep 1970-01-01
anatofuz
parents:
diff changeset
92
anatofuz
parents:
diff changeset
93 ; Populate the cache with files with "old" access times, then check llvm-lto2 updates these file times
anatofuz
parents:
diff changeset
94 ; RUN: rm -Rf %t.cache
anatofuz
parents:
diff changeset
95 ; RUN: llvm-lto2 run -o %t.o %t2.bc %t.bc -cache-dir %t.cache \
anatofuz
parents:
diff changeset
96 ; RUN: -r=%t2.bc,_main,plx \
anatofuz
parents:
diff changeset
97 ; RUN: -r=%t2.bc,_globalfunc,lx \
anatofuz
parents:
diff changeset
98 ; RUN: -r=%t.bc,_globalfunc,plx
anatofuz
parents:
diff changeset
99 ; RUN: touch -a -t 197001011200 %t.cache/llvmcache-*
anatofuz
parents:
diff changeset
100 ; RUN: llvm-lto2 run -o %t.o %t2.bc %t.bc -cache-dir %t.cache \
anatofuz
parents:
diff changeset
101 ; RUN: -r=%t2.bc,_main,plx \
anatofuz
parents:
diff changeset
102 ; RUN: -r=%t2.bc,_globalfunc,lx \
anatofuz
parents:
diff changeset
103 ; RUN: -r=%t.bc,_globalfunc,plx
anatofuz
parents:
diff changeset
104 ; RUN: ls -ltu %t.cache/* | not grep 1970-01-01
anatofuz
parents:
diff changeset
105
anatofuz
parents:
diff changeset
106 ; Verify that specifying max size for the cache directory prunes it to this
anatofuz
parents:
diff changeset
107 ; size, removing the oldest files first.
anatofuz
parents:
diff changeset
108 ; RUN: rm -Rf %t.cache && mkdir %t.cache
anatofuz
parents:
diff changeset
109 ; Create cache files with different sizes.
anatofuz
parents:
diff changeset
110 ; Only 8B and 76B files should stay after pruning.
anatofuz
parents:
diff changeset
111 ; RUN: %python -c "with open(r'%t.cache/llvmcache-foo-100k', 'w') as file: file.truncate(102400)"
anatofuz
parents:
diff changeset
112 ; RUN: touch -t 198002011200 %t.cache/llvmcache-foo-100k
anatofuz
parents:
diff changeset
113 ; RUN: %python -c "with open(r'%t.cache/llvmcache-foo-16', 'w') as file: file.truncate(16)"
anatofuz
parents:
diff changeset
114 ; RUN: touch -t 198002021200 %t.cache/llvmcache-foo-16
anatofuz
parents:
diff changeset
115 ; RUN: %python -c "with open(r'%t.cache/llvmcache-foo-77k', 'w') as file: file.truncate(78848)"
anatofuz
parents:
diff changeset
116 ; RUN: touch -t 198002031200 %t.cache/llvmcache-foo-77k
anatofuz
parents:
diff changeset
117 ; RUN: %python -c "with open(r'%t.cache/llvmcache-foo-8', 'w') as file: file.truncate(8)"
anatofuz
parents:
diff changeset
118 ; RUN: touch -t 198002041200 %t.cache/llvmcache-foo-8
anatofuz
parents:
diff changeset
119 ; RUN: %python -c "with open(r'%t.cache/llvmcache-foo-76', 'w') as file: file.truncate(76)"
anatofuz
parents:
diff changeset
120 ; RUN: touch -t 198002051200 %t.cache/llvmcache-foo-76
anatofuz
parents:
diff changeset
121 ; RUN: llvm-lto -thinlto-action=run -exported-symbol=globalfunc %t2.bc %t.bc -thinlto-cache-dir %t.cache --thinlto-cache-max-size-bytes 78847 --thinlto-cache-entry-expiration 4294967295
anatofuz
parents:
diff changeset
122 ; RUN: ls %t.cache/llvmcache-foo-8
anatofuz
parents:
diff changeset
123 ; RUN: ls %t.cache/llvmcache-foo-76
anatofuz
parents:
diff changeset
124 ; RUN: not ls %t.cache/llvmcache-foo-16
anatofuz
parents:
diff changeset
125 ; RUN: not ls %t.cache/llvmcache-foo-100k
anatofuz
parents:
diff changeset
126 ; RUN: not ls %t.cache/llvmcache-foo-77k
anatofuz
parents:
diff changeset
127
anatofuz
parents:
diff changeset
128 ; Verify that specifying a max size > 4GB for the cache directory does not
anatofuz
parents:
diff changeset
129 ; prematurely prune, due to an integer overflow.
anatofuz
parents:
diff changeset
130 ; RUN: rm -Rf %t.cache && mkdir %t.cache
anatofuz
parents:
diff changeset
131 ; RUN: %python -c "with open(r'%t.cache/llvmcache-foo-10', 'w') as file: file.truncate(10)"
anatofuz
parents:
diff changeset
132 ; RUN: llvm-lto -thinlto-action=run -exported-symbol=globalfunc %t2.bc %t.bc -thinlto-cache-dir %t.cache --thinlto-cache-max-size-bytes 4294967297
anatofuz
parents:
diff changeset
133 ; RUN: ls %t.cache/llvmcache-foo-10
anatofuz
parents:
diff changeset
134
anatofuz
parents:
diff changeset
135 ; Verify that negative numbers aren't accepted for the
anatofuz
parents:
diff changeset
136 ; --thinlto-cache-max-size-bytes switch
anatofuz
parents:
diff changeset
137 ; RUN: rm -Rf %t.cache && mkdir %t.cache
anatofuz
parents:
diff changeset
138 ; RUN: not llvm-lto %t.bc --thinlto-cache-max-size-bytes -1 2>&1 | FileCheck %s
anatofuz
parents:
diff changeset
139 ; CHECK: -thinlto-cache-max-size-bytes option: '-1' value invalid
anatofuz
parents:
diff changeset
140
anatofuz
parents:
diff changeset
141 ; Verify that specifying max number of files in the cache directory prunes
anatofuz
parents:
diff changeset
142 ; it to this amount, removing the oldest files first.
anatofuz
parents:
diff changeset
143 ; RUN: rm -Rf %t.cache && mkdir %t.cache
anatofuz
parents:
diff changeset
144 ; Create cache files with different sizes.
anatofuz
parents:
diff changeset
145 ; Only 75B and 76B files should stay after pruning.
anatofuz
parents:
diff changeset
146 ; RUN: %python -c "print(' ' * 1023)" > %t.cache/llvmcache-foo-1023
anatofuz
parents:
diff changeset
147 ; RUN: touch -t 198002011200 %t.cache/llvmcache-foo-1023
anatofuz
parents:
diff changeset
148 ; RUN: %python -c "print(' ' * 15)" > %t.cache/llvmcache-foo-15
anatofuz
parents:
diff changeset
149 ; RUN: touch -t 198002021200 %t.cache/llvmcache-foo-15
anatofuz
parents:
diff changeset
150 ; RUN: %python -c "print(' ' * 7)" > %t.cache/llvmcache-foo-7
anatofuz
parents:
diff changeset
151 ; RUN: touch -t 198002031200 %t.cache/llvmcache-foo-7
anatofuz
parents:
diff changeset
152 ; RUN: %python -c "print(' ' * 75)" > %t.cache/llvmcache-foo-75
anatofuz
parents:
diff changeset
153 ; RUN: touch -t 198002041200 %t.cache/llvmcache-foo-75
anatofuz
parents:
diff changeset
154 ; RUN: %python -c "print(' ' * 76)" > %t.cache/llvmcache-foo-76
anatofuz
parents:
diff changeset
155 ; RUN: touch -t 198002051200 %t.cache/llvmcache-foo-76
anatofuz
parents:
diff changeset
156 ; RUN: llvm-lto -thinlto-action=run -exported-symbol=globalfunc %t2.bc %t.bc -thinlto-cache-dir %t.cache --thinlto-cache-max-size-files 4 --thinlto-cache-entry-expiration 4294967295
anatofuz
parents:
diff changeset
157 ; RUN: ls %t.cache/llvmcache-foo-75
anatofuz
parents:
diff changeset
158 ; RUN: ls %t.cache/llvmcache-foo-76
anatofuz
parents:
diff changeset
159 ; RUN: not ls %t.cache/llvmcache-foo-15
anatofuz
parents:
diff changeset
160 ; RUN: not ls %t.cache/llvmcache-foo-1024
anatofuz
parents:
diff changeset
161 ; RUN: not ls %t.cache/llvmcache-foo-7
anatofuz
parents:
diff changeset
162
anatofuz
parents:
diff changeset
163 target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
anatofuz
parents:
diff changeset
164 target triple = "x86_64-apple-macosx10.11.0"
anatofuz
parents:
diff changeset
165
anatofuz
parents:
diff changeset
166 define void @globalfunc() #0 {
anatofuz
parents:
diff changeset
167 entry:
anatofuz
parents:
diff changeset
168 ret void
anatofuz
parents:
diff changeset
169 }