|
2 | 2 | ; NetBSD: noatime mounts currently inhibit 'touch' from updating atime
|
3 | 3 | ; UNSUPPORTED: system-netbsd
|
4 | 4 |
|
5 |
| -; RUN: opt -module-hash -module-summary %s -o %t.o |
6 |
| -; RUN: opt -module-hash -module-summary %p/Inputs/cache.ll -o %t2.o |
| 5 | +; RUN: rm -rf %t && mkdir %t && cd %t |
| 6 | +; RUN: opt -module-hash -module-summary %s -o a.bc |
| 7 | +; RUN: opt -module-hash -module-summary %p/Inputs/cache.ll -o b.bc |
7 | 8 |
|
8 |
| -; RUN: rm -Rf %t.cache && mkdir %t.cache |
| 9 | +; RUN: mkdir cache |
9 | 10 | ; Create two files that would be removed by cache pruning due to age.
|
10 | 11 | ; We should only remove files matching the pattern "llvmcache-*".
|
11 |
| -; RUN: touch -t 197001011200 %t.cache/llvmcache-foo %t.cache/foo |
12 |
| -; RUN: ld.lld --thinlto-cache-dir=%t.cache --thinlto-cache-policy prune_after=1h:prune_interval=0s -o %t3 %t2.o %t.o |
| 12 | +; RUN: touch -t 197001011200 cache/llvmcache-foo cache/foo |
| 13 | +; RUN: ld.lld --thinlto-cache-dir=cache --thinlto-cache-policy prune_after=1h:prune_interval=0s -o out b.bc a.bc |
13 | 14 |
|
14 | 15 | ; Two cached objects, plus a timestamp file and "foo", minus the file we removed.
|
15 |
| -; RUN: ls %t.cache | count 4 |
| 16 | +; RUN: ls cache | count 4 |
16 | 17 |
|
17 | 18 | ; Create a file of size 64KB.
|
18 |
| -; RUN: %python -c "print(' ' * 65536)" > %t.cache/llvmcache-foo |
| 19 | +; RUN: %python -c "print(' ' * 65536)" > cache/llvmcache-foo |
19 | 20 |
|
20 | 21 | ; This should leave the file in place.
|
21 |
| -; RUN: ld.lld --thinlto-cache-dir=%t.cache --thinlto-cache-policy cache_size_bytes=128k:prune_interval=0s -o %t3 %t2.o %t.o |
22 |
| -; RUN: ls %t.cache | count 5 |
| 22 | +; RUN: ld.lld --thinlto-cache-dir=cache --thinlto-cache-policy cache_size_bytes=128k:prune_interval=0s -o out b.bc a.bc |
| 23 | +; RUN: ls cache | count 5 |
23 | 24 |
|
24 | 25 | ; Increase the age of llvmcache-foo, which will give it the oldest time stamp
|
25 | 26 | ; so that it is processed and removed first.
|
26 |
| -; RUN: %python -c 'import os,sys,time; t=time.time()-120; os.utime(sys.argv[1],(t,t))' %t.cache/llvmcache-foo |
| 27 | +; RUN: %python -c 'import os,sys,time; t=time.time()-120; os.utime(sys.argv[1],(t,t))' cache/llvmcache-foo |
27 | 28 |
|
28 | 29 | ; This should remove it.
|
29 |
| -; RUN: ld.lld --thinlto-cache-dir=%t.cache --thinlto-cache-policy cache_size_bytes=32k:prune_interval=0s -o %t3 %t2.o %t.o |
30 |
| -; RUN: ls %t.cache | count 4 |
| 30 | +; RUN: ld.lld --thinlto-cache-dir=cache --thinlto-cache-policy cache_size_bytes=32k:prune_interval=0s -o out b.bc a.bc |
| 31 | +; RUN: ls cache | count 4 |
31 | 32 |
|
32 | 33 | ; Setting max number of files to 0 should disable the limit, not delete everything.
|
33 |
| -; RUN: ld.lld --thinlto-cache-dir=%t.cache --thinlto-cache-policy prune_after=0s:cache_size=0%:cache_size_files=0:prune_interval=0s -o %t3 %t2.o %t.o |
34 |
| -; RUN: ls %t.cache | count 4 |
| 34 | +; RUN: ld.lld --thinlto-cache-dir=cache --thinlto-cache-policy prune_after=0s:cache_size=0%:cache_size_files=0:prune_interval=0s -o out b.bc a.bc |
| 35 | +; RUN: ls cache | count 4 |
35 | 36 |
|
36 | 37 | ; Delete everything except for the timestamp, "foo" and one cache file.
|
37 |
| -; RUN: ld.lld --thinlto-cache-dir=%t.cache --thinlto-cache-policy prune_after=0s:cache_size=0%:cache_size_files=1:prune_interval=0s -o %t3 %t2.o %t.o |
38 |
| -; RUN: ls %t.cache | count 3 |
| 38 | +; RUN: ld.lld --thinlto-cache-dir=cache --thinlto-cache-policy prune_after=0s:cache_size=0%:cache_size_files=1:prune_interval=0s -o out b.bc a.bc |
| 39 | +; RUN: ls cache | count 3 |
39 | 40 |
|
40 | 41 | ; Check that we remove the least recently used file first.
|
41 |
| -; RUN: rm -fr %t.cache && mkdir %t.cache |
42 |
| -; RUN: echo xyz > %t.cache/llvmcache-old |
43 |
| -; RUN: touch -t 198002011200 %t.cache/llvmcache-old |
44 |
| -; RUN: echo xyz > %t.cache/llvmcache-newer |
45 |
| -; RUN: touch -t 198002021200 %t.cache/llvmcache-newer |
46 |
| -; RUN: ld.lld --thinlto-cache-dir=%t.cache --thinlto-cache-policy prune_after=0s:cache_size=0%:cache_size_files=3:prune_interval=0s -o %t3 %t2.o %t.o |
47 |
| -; RUN: ls %t.cache | FileCheck %s |
| 42 | +; RUN: rm -fr cache && mkdir cache |
| 43 | +; RUN: echo xyz > cache/llvmcache-old |
| 44 | +; RUN: touch -t 198002011200 cache/llvmcache-old |
| 45 | +; RUN: echo xyz > cache/llvmcache-newer |
| 46 | +; RUN: touch -t 198002021200 cache/llvmcache-newer |
| 47 | +; RUN: ld.lld --thinlto-cache-dir=cache --thinlto-cache-policy prune_after=0s:cache_size=0%:cache_size_files=3:prune_interval=0s -o out b.bc a.bc |
| 48 | +; RUN: ls cache | FileCheck %s |
48 | 49 |
|
49 | 50 | ; CHECK-NOT: llvmcache-old
|
50 | 51 | ; CHECK: llvmcache-newer
|
51 | 52 | ; CHECK-NOT: llvmcache-old
|
52 | 53 |
|
| 54 | +; RUN: rm -fr cache && mkdir cache |
| 55 | +; RUN: ld.lld --thinlto-cache-dir=cache --save-temps -o out b.bc a.bc -M | FileCheck %s --check-prefix=MAP |
| 56 | +; RUN: ls out1.lto.o a.bc.0.preopt.bc b.bc.0.preopt.bc |
| 57 | + |
| 58 | +; MAP: llvmcache-{{.*}}:(.text) |
| 59 | +; MAP: llvmcache-{{.*}}:(.text) |
| 60 | + |
53 | 61 | ;; Check that mllvm options participate in the cache key
|
54 |
| -; RUN: rm -rf %t.cache && mkdir %t.cache |
55 |
| -; RUN: ld.lld --thinlto-cache-dir=%t.cache -o %t3 %t2.o %t.o |
56 |
| -; RUN: ls %t.cache | count 3 |
57 |
| -; RUN: ld.lld --thinlto-cache-dir=%t.cache -o %t3 %t2.o %t.o -mllvm -enable-ml-inliner=default |
58 |
| -; RUN: ls %t.cache | count 5 |
| 62 | +; RUN: rm -rf cache && mkdir cache |
| 63 | +; RUN: ld.lld --thinlto-cache-dir=cache -o out b.bc a.bc |
| 64 | +; RUN: ls cache | count 3 |
| 65 | +; RUN: ld.lld --thinlto-cache-dir=cache -o out b.bc a.bc -mllvm -enable-ml-inliner=default |
| 66 | +; RUN: ls cache | count 5 |
59 | 67 |
|
60 | 68 | ;; Adding another option resuls in 2 more cache entries
|
61 |
| -; RUN: rm -rf %t.cache && mkdir %t.cache |
62 |
| -; RUN: ld.lld --thinlto-cache-dir=%t.cache -o %t3 %t2.o %t.o |
63 |
| -; RUN: ls %t.cache | count 3 |
64 |
| -; RUN: ld.lld --thinlto-cache-dir=%t.cache -o %t3 %t2.o %t.o -mllvm -enable-ml-inliner=default |
65 |
| -; RUN: ls %t.cache | count 5 |
66 |
| -; RUN: ld.lld --thinlto-cache-dir=%t.cache -o %t3 %t2.o %t.o -mllvm -enable-ml-inliner=default -mllvm -max-devirt-iterations=1 |
67 |
| -; RUN: ls %t.cache | count 7 |
| 69 | +; RUN: rm -rf cache && mkdir cache |
| 70 | +; RUN: ld.lld --thinlto-cache-dir=cache -o out b.bc a.bc |
| 71 | +; RUN: ls cache | count 3 |
| 72 | +; RUN: ld.lld --thinlto-cache-dir=cache -o out b.bc a.bc -mllvm -enable-ml-inliner=default |
| 73 | +; RUN: ls cache | count 5 |
| 74 | +; RUN: ld.lld --thinlto-cache-dir=cache -o out b.bc a.bc -mllvm -enable-ml-inliner=default -mllvm -max-devirt-iterations=1 |
| 75 | +; RUN: ls cache | count 7 |
68 | 76 |
|
69 | 77 | ;; Changing order may matter - e.g. if overriding -mllvm options - so we get 2 more entries
|
70 |
| -; RUN: ld.lld --thinlto-cache-dir=%t.cache -o %t3 %t2.o %t.o -mllvm -max-devirt-iterations=1 -mllvm -enable-ml-inliner=default |
71 |
| -; RUN: ls %t.cache | count 9 |
| 78 | +; RUN: ld.lld --thinlto-cache-dir=cache -o out b.bc a.bc -mllvm -max-devirt-iterations=1 -mllvm -enable-ml-inliner=default |
| 79 | +; RUN: ls cache | count 9 |
72 | 80 |
|
73 | 81 | ;; Going back to a pre-cached order doesn't create more entries.
|
74 |
| -; RUN: ld.lld --thinlto-cache-dir=%t.cache -o %t3 %t2.o %t.o -mllvm -enable-ml-inliner=default -mllvm -max-devirt-iterations=1 |
75 |
| -; RUN: ls %t.cache | count 9 |
| 82 | +; RUN: ld.lld --thinlto-cache-dir=cache -o out b.bc a.bc -mllvm -enable-ml-inliner=default -mllvm -max-devirt-iterations=1 |
| 83 | +; RUN: ls cache | count 9 |
76 | 84 |
|
77 | 85 | ;; Different flag values matter
|
78 |
| -; RUN: rm -rf %t.cache && mkdir %t.cache |
79 |
| -; RUN: ld.lld --thinlto-cache-dir=%t.cache -o %t3 %t2.o %t.o -mllvm -enable-ml-inliner=default -mllvm -max-devirt-iterations=2 |
80 |
| -; RUN: ls %t.cache | count 3 |
81 |
| -; RUN: ld.lld --thinlto-cache-dir=%t.cache -o %t3 %t2.o %t.o -mllvm -enable-ml-inliner=default -mllvm -max-devirt-iterations=1 |
82 |
| -; RUN: ls %t.cache | count 5 |
| 86 | +; RUN: rm -rf cache && mkdir cache |
| 87 | +; RUN: ld.lld --thinlto-cache-dir=cache -o out b.bc a.bc -mllvm -enable-ml-inliner=default -mllvm -max-devirt-iterations=2 |
| 88 | +; RUN: ls cache | count 3 |
| 89 | +; RUN: ld.lld --thinlto-cache-dir=cache -o out b.bc a.bc -mllvm -enable-ml-inliner=default -mllvm -max-devirt-iterations=1 |
| 90 | +; RUN: ls cache | count 5 |
83 | 91 |
|
84 | 92 | ;; Same flag value passed to different flags matters, and switching the order
|
85 | 93 | ;; of the two flags matters.
|
86 |
| -; RUN: rm -rf %t.cache && mkdir %t.cache |
87 |
| -; RUN: ld.lld --thinlto-cache-dir=%t.cache -o %t3 %t2.o %t.o -mllvm -enable-ml-inliner=default |
88 |
| -; RUN: ls %t.cache | count 3 |
89 |
| -; RUN: ld.lld --thinlto-cache-dir=%t.cache -o %t3 %t2.o %t.o -mllvm -emit-dwarf-unwind=default |
90 |
| -; RUN: ls %t.cache | count 5 |
91 |
| -; RUN: ld.lld --thinlto-cache-dir=%t.cache -o %t3 %t2.o %t.o -mllvm -enable-ml-inliner=default |
92 |
| -; RUN: ls %t.cache | count 5 |
93 |
| -; RUN: ld.lld --thinlto-cache-dir=%t.cache -o %t3 %t2.o %t.o -mllvm -enable-ml-inliner=default -mllvm -emit-dwarf-unwind=default |
94 |
| -; RUN: ls %t.cache | count 7 |
95 |
| -; RUN: ld.lld --thinlto-cache-dir=%t.cache -o %t3 %t2.o %t.o -mllvm -emit-dwarf-unwind=default -mllvm -enable-ml-inliner=default |
96 |
| -; RUN: ls %t.cache | count 9 |
| 94 | +; RUN: rm -rf cache && mkdir cache |
| 95 | +; RUN: ld.lld --thinlto-cache-dir=cache -o out b.bc a.bc -mllvm -enable-ml-inliner=default |
| 96 | +; RUN: ls cache | count 3 |
| 97 | +; RUN: ld.lld --thinlto-cache-dir=cache -o out b.bc a.bc -mllvm -emit-dwarf-unwind=default |
| 98 | +; RUN: ls cache | count 5 |
| 99 | +; RUN: ld.lld --thinlto-cache-dir=cache -o out b.bc a.bc -mllvm -enable-ml-inliner=default |
| 100 | +; RUN: ls cache | count 5 |
| 101 | +; RUN: ld.lld --thinlto-cache-dir=cache -o out b.bc a.bc -mllvm -enable-ml-inliner=default -mllvm -emit-dwarf-unwind=default |
| 102 | +; RUN: ls cache | count 7 |
| 103 | +; RUN: ld.lld --thinlto-cache-dir=cache -o out b.bc a.bc -mllvm -emit-dwarf-unwind=default -mllvm -enable-ml-inliner=default |
| 104 | +; RUN: ls cache | count 9 |
97 | 105 |
|
98 | 106 | target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
|
99 | 107 | target triple = "x86_64-unknown-linux-gnu"
|
|
0 commit comments