[PATCH] D51006: LTO: make tempfiles in LTO cache subject to pruning

Bob Haarman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 20 15:34:20 PDT 2018


inglorion created this revision.
inglorion added a reviewer: rnk.
Herald added subscribers: dexonsmith, steven_wu, hiraditya, mehdi_amini.

CachePruning only considers files with names starting in
"llvmcache-". The LTO cache creates temporary files starting in
"Thin-". This results in surprising behavior, such as running out of
disk space although the cache pruning policy is set to limit the cache
directory to a reasonable size. This change causes the LTO cache to
create temporary files with names that will be handled by the pruner,
avoiding the problem.

Fixes PR38618.


https://reviews.llvm.org/D51006

Files:
  llvm/lib/LTO/Caching.cpp


Index: llvm/lib/LTO/Caching.cpp
===================================================================
--- llvm/lib/LTO/Caching.cpp
+++ llvm/lib/LTO/Caching.cpp
@@ -132,7 +132,8 @@
     return [=](size_t Task) -> std::unique_ptr<NativeObjectStream> {
       // Write to a temporary to avoid race condition
       SmallString<64> TempFilenameModel;
-      sys::path::append(TempFilenameModel, CacheDirectoryPath, "Thin-%%%%%%.tmp.o");
+      sys::path::append(TempFilenameModel, CacheDirectoryPath,
+                        "llvmcache-%%%%%%.tmp.o");
       Expected<sys::fs::TempFile> Temp = sys::fs::TempFile::create(
           TempFilenameModel, sys::fs::owner_read | sys::fs::owner_write);
       if (!Temp) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51006.161589.patch
Type: text/x-patch
Size: 711 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180820/8cc95d73/attachment.bin>


More information about the llvm-commits mailing list