[PATCH] D41231: [Support][CachePruning] Fix regression that prevents disabling of pruning
ben via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 14 05:21:29 PST 2017
bd1976llvm created this revision.
bd1976llvm added reviewers: labath, pcc, mehdi_amini, tejohnson.
Herald added a subscriber: eraman.
borked by: https://reviews.llvm.org/rL284966 (see: https://reviews.llvm.org/D25730).
Previously, Interval was unsigned (see: CachePruning.h), replacing the type with std::chrono::seconds (which is signed) causes a regression in behaviour because the c-api intends negative values to translate to large positive intervals to *effectively* disable the pruning (see comments on: setCachePruningInterval()).
https://reviews.llvm.org/D41231
Files:
include/llvm/LTO/legacy/ThinLTOCodeGenerator.h
Index: include/llvm/LTO/legacy/ThinLTOCodeGenerator.h
===================================================================
--- include/llvm/LTO/legacy/ThinLTOCodeGenerator.h
+++ include/llvm/LTO/legacy/ThinLTOCodeGenerator.h
@@ -149,10 +149,12 @@
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. A value of 0 will be ignored.
+ /// negative value to disable pruning. A value of 0 will be ignored.
void setCachePruningInterval(int Interval) {
- if (Interval)
- CacheOptions.Policy.Interval = std::chrono::seconds(Interval);
+ if (Interval)
+ CacheOptions.Policy.Interval = Interval > 0
+ ? std::chrono::seconds(Interval)
+ : std::chrono::seconds::max();
}
/// Cache policy: expiration (in seconds) for an entry.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41231.126934.patch
Type: text/x-patch
Size: 927 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171214/bc0cbfaf/attachment.bin>
More information about the llvm-commits
mailing list