| 1 |
; Verify that enabling caching is ignoring module when we emit them without hash. |
| 2 |
; RUN: opt -module-summary %s -o %t.o |
| 3 |
; RUN: opt -module-summary %p/Inputs/cache.ll -o %t2.o |
| 4 |
|
| 5 |
; RUN: rm -Rf %t.cache |
| 6 |
; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \ |
| 7 |
; RUN: --plugin-opt=thinlto \ |
| 8 |
; RUN: --plugin-opt=cache-dir=%t.cache \ |
| 9 |
; RUN: -o %t3.o %t2.o %t.o |
| 10 |
|
| 11 |
; Since nothing was added to the cache, there shouldn't be a timestamp file yet. |
| 12 |
; RUN: not ls %t.cache |
| 13 |
|
| 14 |
|
| 15 |
; Verify that enabling caching is working with module with hash. |
| 16 |
|
| 17 |
; RUN: opt -module-hash -module-summary %s -o %t.o |
| 18 |
; RUN: opt -module-hash -module-summary %p/Inputs/cache.ll -o %t2.o |
| 19 |
|
| 20 |
; RUN: rm -Rf %t.cache |
| 21 |
; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \ |
| 22 |
; RUN: --plugin-opt=thinlto \ |
| 23 |
; RUN: --plugin-opt=cache-dir=%t.cache \ |
| 24 |
; RUN: -o %t3.o %t2.o %t.o |
| 25 |
|
| 26 |
; Two cached objects, plus a timestamp file |
| 27 |
; RUN: ls %t.cache | count 3 |
| 28 |
|
| 29 |
|
| 30 |
; Create two files that would be removed by cache pruning due to age. |
| 31 |
; We should only remove files matching the pattern "llvmcache-*". |
| 32 |
|
| 33 |
; RUN: touch -t 197001011200 %t.cache/llvmcache-foo %t.cache/foo |
| 34 |
; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \ |
| 35 |
; RUN: --plugin-opt=thinlto \ |
| 36 |
; RUN: --plugin-opt=cache-dir=%t.cache \ |
| 37 |
; RUN: --plugin-opt=cache-policy=prune_after=1h:prune_interval=0s \ |
| 38 |
; RUN: -o %t3.o %t2.o %t.o |
| 39 |
|
| 40 |
; Two cached objects, plus a timestamp file and "foo", minus the file we removed. |
| 41 |
; RUN: ls %t.cache | count 4 |
| 42 |
|
| 43 |
|
| 44 |
; Create a file of size 64KB. |
| 45 |
; RUN: %python -c "print(' ' * 65536)" > %t.cache/llvmcache-foo |
| 46 |
|
| 47 |
; This should leave the file in place. |
| 48 |
; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \ |
| 49 |
; RUN: --plugin-opt=thinlto \ |
| 50 |
; RUN: --plugin-opt=cache-dir=%t.cache \ |
| 51 |
; RUN: --plugin-opt=cache-policy=cache_size_bytes=128k:prune_interval=0s \ |
| 52 |
; RUN: -o %t3.o %t2.o %t.o |
| 53 |
; RUN: ls %t.cache | count 5 |
| 54 |
|
| 55 |
|
| 56 |
; Increase the age of llvmcache-foo |
| 57 |
; RUN: touch -r %t.cache/llvmcache-foo -d '-2 minutes' %t.cache/llvmcache-foo |
| 58 |
|
| 59 |
; This should remove it. |
| 60 |
; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \ |
| 61 |
; RUN: --plugin-opt=thinlto \ |
| 62 |
; RUN: --plugin-opt=save-temps \ |
| 63 |
; RUN: --plugin-opt=cache-dir=%t.cache \ |
| 64 |
; RUN: --plugin-opt=cache-policy=cache_size_bytes=32k:prune_interval=0s \ |
| 65 |
; RUN: -o %t4.o %t2.o %t.o |
| 66 |
; RUN: ls %t.cache | count 4 |
| 67 |
; With save-temps we can confirm that the cached files were copied into temp |
| 68 |
; files to avoid a race condition with the cached files being pruned, since the |
| 69 |
; gold plugin-api only accepts native objects passed back as files. |
| 70 |
; RUN: ls %t4.o.lto.o1 %t4.o.lto.o2 |
| 71 |
|
| 72 |
|
| 73 |
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" |
| 74 |
target triple = "x86_64-unknown-linux-gnu" |
| 75 |
|
| 76 |
define void @globalfunc() #0 { |
| 77 |
entry: |
| 78 |
ret void |
| 79 |
} |