[PATCH] D43389: [ThinLTO/gold] Perform cache pruning when cache directory specified

Teresa Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 16 07:49:59 PST 2018


tejohnson created this revision.
tejohnson added a reviewer: pcc.
Herald added a subscriber: inglorion.

As pointed out in the review for https://reviews.llvm.org/D37993, for consistency with other
linkers, gold plugin should perform cache pruning whenever there is a
cache directory specified, which will use the default cache policy.


Repository:
  rL LLVM

https://reviews.llvm.org/D43389

Files:
  test/tools/gold/X86/cache.ll
  tools/gold/gold-plugin.cpp


Index: tools/gold/gold-plugin.cpp
===================================================================
--- tools/gold/gold-plugin.cpp
+++ tools/gold/gold-plugin.cpp
@@ -973,7 +973,7 @@
   }
 
   // Prune cache
-  if (!options::cache_policy.empty()) {
+  if (!options::cache_dir.empty()) {
     CachePruningPolicy policy = check(parseCachePruningPolicy(options::cache_policy));
     pruneCache(options::cache_dir, policy);
   }
Index: test/tools/gold/X86/cache.ll
===================================================================
--- test/tools/gold/X86/cache.ll
+++ test/tools/gold/X86/cache.ll
@@ -8,7 +8,8 @@
 ; RUN:     --plugin-opt=cache-dir=%t.cache \
 ; RUN:     -o %t3.o %t2.o %t.o
 
-; RUN: ls %t.cache | count 0
+; We should just get the timestamp file
+; RUN: ls %t.cache | count 1
 
 
 ; Verify that enabling caching is working with module with hash.
@@ -22,7 +23,8 @@
 ; RUN:     --plugin-opt=cache-dir=%t.cache \
 ; RUN:     -o %t3.o %t2.o %t.o
 
-; RUN: ls %t.cache | count 2
+; Two cached objects, plus a timestamp file
+; RUN: ls %t.cache | count 3
 
 
 ; Create two files that would be removed by cache pruning due to age.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43389.134619.patch
Type: text/x-patch
Size: 1141 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180216/00669791/attachment.bin>


More information about the llvm-commits mailing list