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