llvm.org GIT mirror llvm / 7eee232
Revert r342233. This caused LLD test failures, which I've been unable to reproduce. Reverting to allow for further investigation next week. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@342244 91177308-0d34-0410-b5e6-96231b3b80d8 James Henderson 2 years ago
6 changed file(s) with 3 addition(s) and 34 deletion(s). Raw diff Collapse all Expand all
186186 /// Cache policy: the maximum size for the cache directory in bytes. A value
187187 /// over the amount of available space on the disk will be reduced to the
188188 /// amount of available space. A value of 0 will be ignored.
189 void setCacheMaxSizeBytes(uint64_t MaxSizeBytes) {
189 void setCacheMaxSizeBytes(unsigned MaxSizeBytes) {
190190 if (MaxSizeBytes)
191191 CacheOptions.Policy.MaxSizeBytes = MaxSizeBytes;
192192 }
4343 * @{
4444 */
4545
46 #define LTO_API_VERSION 23
46 #define LTO_API_VERSION 22
4747
4848 /**
4949 * \since prior to LTO_API_VERSION=3
827827 unsigned max_size_bytes);
828828
829829 /**
830 * Same as thinlto_codegen_set_cache_size_bytes, except the maximum size is in
831 * megabytes (2^20 bytes).
832 *
833 * \since LTO_API_VERSION=23
834 */
835 extern void
836 thinlto_codegen_set_cache_size_megabytes(thinlto_code_gen_t cg,
837 unsigned max_size_megabytes);
838
839 /**
840830 * Sets the maximum number of files in the cache directory. An unspecified
841831 * default value will be applied. A value of 0 will be ignored.
842832 *
120120 ; RUN: not ls %t.cache/llvmcache-foo-100k
121121 ; RUN: not ls %t.cache/llvmcache-foo-77k
122122
123 ; Verify that specifying a max size > 4GB for the cache directory does not
124 ; prematurely prune, due to an integer overflow.
125 ; RUN: rm -Rf %t.cache && mkdir %t.cache
126 ; RUN: %python -c "with open(r'%t.cache/llvmcache-foo-10', 'w') as file: file.truncate(10)"
127 ; RUN: llvm-lto -thinlto-action=run -exported-symbol=globalfunc %t2.bc %t.bc -thinlto-cache-dir %t.cache --thinlto-cache-max-size-bytes 4294967297
128 ; RUN: ls %t.cache/llvmcache-foo-10
129
130 ; Verify that negative numbers aren't accepted for the
131 ; --thinlto-cache-max-size-bytes switch
132 ; RUN: rm -Rf %t.cache && mkdir %t.cache
133 ; RUN: not llvm-lto %t.bc --thinlto-cache-max-size-bytes -1 2>&1 | FileCheck %s
134 ; CHECK: -thinlto-cache-max-size-bytes option: '-1' value invalid
135
136123 ; Verify that specifying max number of files in the cache directory prunes
137124 ; it to this amount, removing the oldest files first.
138125 ; RUN: rm -Rf %t.cache && mkdir %t.cache
157157 ThinLTOCachePruningInterval("thinlto-cache-pruning-interval",
158158 cl::init(1200), cl::desc("Set ThinLTO cache pruning interval."));
159159
160 static cl::opt<unsigned long long>
160 static cl::opt<int>
161161 ThinLTOCacheMaxSizeBytes("thinlto-cache-max-size-bytes",
162162 cl::desc("Set ThinLTO cache pruning directory maximum size in bytes."));
163163
590590 return unwrap(cg)->setCacheMaxSizeBytes(MaxSizeBytes);
591591 }
592592
593 void thinlto_codegen_set_cache_size_megabytes(
594 thinlto_code_gen_t cg, unsigned MaxSizeMegabytes) {
595 uint64_t MaxSizeBytes = MaxSizeMegabytes;
596 MaxSizeBytes *= 1024 * 1024;
597 return unwrap(cg)->setCacheMaxSizeBytes(MaxSizeBytes);
598 }
599
600593 void thinlto_codegen_set_cache_size_files(
601594 thinlto_code_gen_t cg, unsigned MaxSizeFiles) {
602595 return unwrap(cg)->setCacheMaxSizeFiles(MaxSizeFiles);
5757 thinlto_codegen_set_cache_entry_expiration
5858 thinlto_codegen_set_final_cache_size_relative_to_available_space
5959 thinlto_codegen_set_cache_size_bytes
60 thinlto_codegen_set_cache_size_megabytes
6160 thinlto_codegen_set_cache_size_files
6261 thinlto_codegen_set_savetemps_dir
6362 thinlto_codegen_set_cpu