diff options
-rw-r--r-- | llvm/test/ThinLTO/X86/cache.ll | 8 | ||||
-rw-r--r-- | llvm/tools/llvm-lto/llvm-lto.cpp | 5 |
2 files changed, 11 insertions, 2 deletions
diff --git a/llvm/test/ThinLTO/X86/cache.ll b/llvm/test/ThinLTO/X86/cache.ll index 08eb5733dd6..c7eebf6703e 100644 --- a/llvm/test/ThinLTO/X86/cache.ll +++ b/llvm/test/ThinLTO/X86/cache.ll @@ -113,8 +113,10 @@ ; RUN: %python -c "with open(r'%t.cache/llvmcache-foo-77k', 'w') as file: file.truncate(78848)" ; RUN: touch -t 198002031200 %t.cache/llvmcache-foo-77k ; RUN: %python -c "with open(r'%t.cache/llvmcache-foo-8', 'w') as file: file.truncate(8)" +; RUN: touch -t 198002041200 %t.cache/llvmcache-foo-8 ; RUN: %python -c "with open(r'%t.cache/llvmcache-foo-76', 'w') as file: file.truncate(76)" -; RUN: llvm-lto -thinlto-action=run -exported-symbol=globalfunc %t2.bc %t.bc -thinlto-cache-dir %t.cache --thinlto-cache-max-size-bytes 78847 +; RUN: touch -t 198002051200 %t.cache/llvmcache-foo-76 +; 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 ; RUN: ls %t.cache/llvmcache-foo-8 ; RUN: ls %t.cache/llvmcache-foo-76 ; RUN: not ls %t.cache/llvmcache-foo-16 @@ -146,8 +148,10 @@ ; RUN: %python -c "print(' ' * 7)" > %t.cache/llvmcache-foo-7 ; RUN: touch -t 198002031200 %t.cache/llvmcache-foo-7 ; RUN: %python -c "print(' ' * 75)" > %t.cache/llvmcache-foo-75 +; RUN: touch -t 198002041200 %t.cache/llvmcache-foo-75 ; RUN: %python -c "print(' ' * 76)" > %t.cache/llvmcache-foo-76 -; RUN: llvm-lto -thinlto-action=run -exported-symbol=globalfunc %t2.bc %t.bc -thinlto-cache-dir %t.cache --thinlto-cache-max-size-files 4 +; RUN: touch -t 198002051200 %t.cache/llvmcache-foo-76 +; 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 ; RUN: ls %t.cache/llvmcache-foo-75 ; RUN: ls %t.cache/llvmcache-foo-76 ; RUN: not ls %t.cache/llvmcache-foo-15 diff --git a/llvm/tools/llvm-lto/llvm-lto.cpp b/llvm/tools/llvm-lto/llvm-lto.cpp index 25f086fdac9..dd19424157c 100644 --- a/llvm/tools/llvm-lto/llvm-lto.cpp +++ b/llvm/tools/llvm-lto/llvm-lto.cpp @@ -166,6 +166,10 @@ static cl::opt<int> ThinLTOCacheMaxSizeFiles("thinlto-cache-max-size-files", cl::init(1000000), cl::desc("Set ThinLTO cache pruning directory maximum number of files.")); +static cl::opt<unsigned> + ThinLTOCacheEntryExpiration("thinlto-cache-entry-expiration", cl::init(604800) /* 1w */, + cl::desc("Set ThinLTO cache entry expiration time.")); + static cl::opt<std::string> ThinLTOSaveTempsPrefix( "thinlto-save-temps", cl::desc("Save ThinLTO temp files using filenames created by adding " @@ -481,6 +485,7 @@ public: ThinGenerator.setTargetOptions(Options); ThinGenerator.setCacheDir(ThinLTOCacheDir); ThinGenerator.setCachePruningInterval(ThinLTOCachePruningInterval); + ThinGenerator.setCacheEntryExpiration(ThinLTOCacheEntryExpiration); ThinGenerator.setCacheMaxSizeFiles(ThinLTOCacheMaxSizeFiles); ThinGenerator.setCacheMaxSizeBytes(ThinLTOCacheMaxSizeBytes); ThinGenerator.setFreestanding(EnableFreestanding); |