[llvm] r325830 - [ThinLTO/gold] Perform cache pruning when cache directory specified

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 22 12:57:05 PST 2018


Author: tejohnson
Date: Thu Feb 22 12:57:05 2018
New Revision: 325830

URL: http://llvm.org/viewvc/llvm-project?rev=325830&view=rev
Log:
[ThinLTO/gold] Perform cache pruning when cache directory specified

Summary:
As pointed out in the review for 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.

Reviewers: pcc

Subscribers: llvm-commits, inglorion

Differential Revision: https://reviews.llvm.org/D43389

Modified:
    llvm/trunk/test/tools/gold/X86/cache.ll
    llvm/trunk/tools/gold/gold-plugin.cpp

Modified: llvm/trunk/test/tools/gold/X86/cache.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/gold/X86/cache.ll?rev=325830&r1=325829&r2=325830&view=diff
==============================================================================
--- llvm/trunk/test/tools/gold/X86/cache.ll (original)
+++ llvm/trunk/test/tools/gold/X86/cache.ll Thu Feb 22 12:57:05 2018
@@ -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.

Modified: llvm/trunk/tools/gold/gold-plugin.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/gold/gold-plugin.cpp?rev=325830&r1=325829&r2=325830&view=diff
==============================================================================
--- llvm/trunk/tools/gold/gold-plugin.cpp (original)
+++ llvm/trunk/tools/gold/gold-plugin.cpp Thu Feb 22 12:57:05 2018
@@ -1014,7 +1014,7 @@ static ld_plugin_status cleanup_hook(voi
   }
 
   // Prune cache
-  if (!options::cache_policy.empty()) {
+  if (!options::cache_dir.empty()) {
     CachePruningPolicy policy = check(parseCachePruningPolicy(options::cache_policy));
     pruneCache(options::cache_dir, policy);
   }




More information about the llvm-commits mailing list