[PATCH] D94962: [ThinLTO] Also prune Thin-* files from the ThinLTO cache

Hans Wennborg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 19 05:44:10 PST 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGec877106a38b: [ThinLTO] Also prune Thin-* files from the ThinLTO cache (authored by hans).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D94962/new/

https://reviews.llvm.org/D94962

Files:
  lld/test/COFF/lto-cache.ll
  llvm/lib/Support/CachePruning.cpp


Index: llvm/lib/Support/CachePruning.cpp
===================================================================
--- llvm/lib/Support/CachePruning.cpp
+++ llvm/lib/Support/CachePruning.cpp
@@ -211,11 +211,12 @@
   // Walk all of the files within this directory.
   for (sys::fs::directory_iterator File(CachePathNative, EC), FileEnd;
        File != FileEnd && !EC; File.increment(EC)) {
-    // Ignore any files not beginning with the string "llvmcache-". This
+    // Ignore filenames not beginning with "llvmcache-" or "Thin-". This
     // includes the timestamp file as well as any files created by the user.
     // This acts as a safeguard against data loss if the user specifies the
     // wrong directory as their cache directory.
-    if (!sys::path::filename(File->path()).startswith("llvmcache-"))
+    StringRef filename = sys::path::filename(File->path());
+    if (!filename.startswith("llvmcache-") && !filename.startswith("Thin-"))
       continue;
 
     // Look at this file. If we can't stat it, there's nothing interesting
Index: lld/test/COFF/lto-cache.ll
===================================================================
--- lld/test/COFF/lto-cache.ll
+++ lld/test/COFF/lto-cache.ll
@@ -7,8 +7,8 @@
 
 ; RUN: rm -Rf %t.cache && mkdir %t.cache
 ; Create two files that would be removed by cache pruning due to age.
-; We should only remove files matching the pattern "llvmcache-*".
-; RUN: touch -t 197001011200 %t.cache/llvmcache-foo %t.cache/foo
+; We should only remove files matching "llvmcache-*" or "Thin-*".
+; RUN: touch -t 197001011200 %t.cache/llvmcache-foo %t.cache/Thin-123.tmp.o %t.cache/foo
 ; RUN: lld-link /lldltocache:%t.cache /lldltocachepolicy:prune_after=1h /out:%t3 /entry:main %t2.o %t.o
 
 ; Two cached objects, plus a timestamp file and "foo", minus the file we removed.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94962.317538.patch
Type: text/x-patch
Size: 1816 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210119/1af80c39/attachment.bin>


More information about the llvm-commits mailing list