brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.6 KiB · de6324a Raw
64 lines · plain
1; REQUIRES: x862 3; RUN: rm -rf %t; split-file %s %t4; RUN: opt -module-hash -module-summary %t/foo.ll -o %t/foo.o5; RUN: opt -module-hash -module-summary %t/bar.ll -o %t/bar.o6 7;; Check cache policies of the number of files.8;; Case 1: A value of 0 disables the number of files based pruning. Therefore, there is no warning.9; RUN: %lld -v -cache_path_lto %t --thinlto-cache-policy=prune_interval=0s:cache_size_files=0 -o %t/test %t/foo.o %t/bar.o 2>&1 | FileCheck %s --implicit-check-not=warning:10;; Case 2: If the total number of the files created by the current link job is less than the maximum number of files, there is no warning.11; RUN: %lld -v -cache_path_lto %t --thinlto-cache-policy=prune_interval=0s:cache_size_files=3 %t/foo.o %t/bar.o -o %t/test 2>&1 | FileCheck %s --implicit-check-not=warning:12;; Case 3: If the total number of the files created by the current link job exceeds the maximum number of files, a warning is given.13; RUN: %lld -cache_path_lto %t --thinlto-cache-policy=prune_interval=0s:cache_size_files=1 %t/foo.o %t/bar.o -o %t/test 2>&1 | FileCheck %s --check-prefixes=NUM,WARN14 15;; Check cache policies of the cache size.16;; Case 1: A value of 0 disables the absolute size-based pruning. Therefore, there is no warning.17; RUN: %lld -v -cache_path_lto %t --thinlto-cache-policy=prune_interval=0s:cache_size_bytes=0 %t/foo.o %t/bar.o -o %t/test 2>&1 | FileCheck %s --implicit-check-not=warning:18 19;; Get the total size of created cache files.20; RUN: cd %t21; RUN: %lld -cache_path_lto %t --thinlto-cache-policy=prune_interval=0s:cache_size_bytes=32k %t/foo.o %t/bar.o -o %t/test 2>&122; RUN: %python -c "import os, sys; size=sum(os.path.getsize(filename) for filename in os.listdir('.') if os.path.isfile(filename) and filename.startswith('llvmcache-')); print(size+5); print(size-5)" > %t.size.txt23 24;; Case 2: If the total size of the cache files created by the current link job is less than the maximum size for the cache directory in bytes, there is no warning.25; RUN: echo -n "--thinlto-cache-policy=prune_interval=0s:cache_size_bytes=" > %t.response26; RUN: head -1 %t.size.txt >> %t.response27; RUN: %lld -v -cache_path_lto %t @%t.response %t/foo.o %t/bar.o -o %t/test 2>&1 | FileCheck %s --implicit-check-not=warning:28 29;; Case 3: If the total size of the cache files created by the current link job exceeds the maximum size for the cache directory in bytes, a warning is given.30; RUN: echo -n "--thinlto-cache-policy=prune_interval=0s:cache_size_bytes=" > %t.response31; RUN: tail -1 %t.size.txt >> %t.response32; RUN: %lld -v -cache_path_lto %t @%t.response %t/foo.o %t/bar.o -o %t/test 2>&1 | FileCheck %s --check-prefixes=SIZE,WARN33 34;; Check emit two warnings if pruning happens due to reach both the size and number limits.35; RUN: %lld -cache_path_lto %t --thinlto-cache-policy=prune_interval=0s:cache_size_files=1:cache_size_bytes=1 %t/foo.o %t/bar.o -o %t/test 2>&1 | FileCheck %s --check-prefixes=NUM,SIZE,WARN36 37; NUM: warning: ThinLTO cache pruning happens since the number of{{.*}}--thinlto-cache-policy38; SIZE: warning: ThinLTO cache pruning happens since the total size of{{.*}}--thinlto-cache-policy39; WARN-NOT: warning: ThinLTO cache pruning happens{{.*}}--thinlto-cache-policy40 41;--- foo.ll42 43target triple = "x86_64-apple-macosx10.15.0"44target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"45 46define void @globalfunc() #0 {47entry:48  ret void49}50 51 52;--- bar.ll53 54target triple = "x86_64-apple-macosx10.15.0"55target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"56 57define i32 @main() {58entry:59  call void (...) @globalfunc()60  ret i32 061}62 63declare void @globalfunc(...)64