[llvm] r268890 - ThinLTOCodeGenerator: ignore 0 values for the cache settings.

Mehdi Amini via llvm-commits llvm-commits at lists.llvm.org
Sun May 8 22:16:31 PDT 2016


Author: mehdi_amini
Date: Mon May  9 00:16:30 2016
New Revision: 268890

URL: http://llvm.org/viewvc/llvm-project?rev=268890&view=rev
Log:
ThinLTOCodeGenerator: ignore 0 values for the cache settings.

From: Mehdi Amini <mehdi.amini at apple.com>

Modified:
    llvm/trunk/include/llvm-c/lto.h
    llvm/trunk/include/llvm/LTO/ThinLTOCodeGenerator.h

Modified: llvm/trunk/include/llvm-c/lto.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/lto.h?rev=268890&r1=268889&r2=268890&view=diff
==============================================================================
--- llvm/trunk/include/llvm-c/lto.h (original)
+++ llvm/trunk/include/llvm-c/lto.h Mon May  9 00:16:30 2016
@@ -668,7 +668,8 @@ extern void thinlto_codegen_set_cache_di
 
 /**
  * Sets the cache pruning interval (in seconds). A negative value disable the
- * pruning. An unspecified default value will be applied.
+ * pruning. An unspecified default value will be applied, and a value of 0 will
+ * be ignored.
  *
  * \since LTO_API_VERSION=18
  */
@@ -679,8 +680,8 @@ extern void thinlto_codegen_set_cache_pr
  * Sets the maximum cache size that can be persistent across build, in terms of
  * percentage of the available space on the the disk. Set to 100 to indicate
  * no limit, 50 to indicate that the cache size will not be left over half the
- * available space. A value over 100 will be reduced to 100. An unspecified 
- * default value will be applied.
+ * available space. A value over 100 will be reduced to 100, a value of 0 will
+ * be ignored. An unspecified default value will be applied.
  *
  * The formula looks like:
  *  AvailableSpace = FreeSpace + ExistingCacheSize
@@ -693,7 +694,7 @@ extern void thinlto_codegen_set_final_ca
 
 /**
  * Sets the expiration (in seconds) for an entry in the cache. An unspecified
- * default value will be applied.
+ * default value will be applied. A value of 0 will be ignored.
  *
  * \since LTO_API_VERSION=18
  */

Modified: llvm/trunk/include/llvm/LTO/ThinLTOCodeGenerator.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/LTO/ThinLTOCodeGenerator.h?rev=268890&r1=268889&r2=268890&view=diff
==============================================================================
--- llvm/trunk/include/llvm/LTO/ThinLTOCodeGenerator.h (original)
+++ llvm/trunk/include/llvm/LTO/ThinLTOCodeGenerator.h Mon May  9 00:16:30 2016
@@ -119,21 +119,27 @@ public:
   void setCacheDir(std::string Path) { CacheOptions.Path = std::move(Path); }
 
   /// Cache policy: interval (seconds) between two prune of the cache. Set to a
-  /// negative value (default) to disable pruning.
+  /// negative value (default) to disable pruning. A value of 0 will be ignored.
   void setCachePruningInterval(int Interval) {
-    CacheOptions.PruningInterval = Interval;
+    fprintf(stderr, "setCachePruningInterval %d\n", Interval);
+    if (Interval)
+      CacheOptions.PruningInterval = Interval;
   }
 
   /// Cache policy: expiration (in seconds) for an entry.
+  /// A value of 0 will be ignored.
   void setCacheEntryExpiration(unsigned Expiration) {
-    CacheOptions.Expiration = Expiration;
+    if (Expiration)
+      CacheOptions.Expiration = Expiration;
   }
 
   /**
    * Sets the maximum cache size that can be persistent across build, in terms
    * of percentage of the available space on the the disk. Set to 100 to
    * indicate no limit, 50 to indicate that the cache size will not be left over
-   * half the available space. A value over 100 will be reduced to 100.
+   * half the available space. A value over 100 will be reduced to 100, and a
+   * value of 0 will be ignored.
+   *
    *
    * The formula looks like:
    *  AvailableSpace = FreeSpace + ExistingCacheSize
@@ -141,7 +147,8 @@ public:
    *
    */
   void setMaxCacheSizeRelativeToAvailableSpace(unsigned Percentage) {
-    CacheOptions.MaxPercentageOfAvailableSpace = Percentage;
+    if (Percentage)
+      CacheOptions.MaxPercentageOfAvailableSpace = Percentage;
   }
 
   /**@}*/




More information about the llvm-commits mailing list