48 lines · plain
1; REQUIRES: x862 3; RUN: opt -module-hash -module-summary %s -o %t.o4; RUN: opt -module-hash -module-summary %p/Inputs/lto-cache.ll -o %t2.o5 6; RUN: rm -rf %t && mkdir %t7 8;; Check cache policies of the number of files.9;; Case 1: A value of 0 disables the number of files based pruning. Therefore, there is no warning.10; RUN: lld-link /verbose /lldltocache:%t /lldltocachepolicy:prune_interval=0s:cache_size_files=0 /out:%t3 /entry:main %t2.o %t.o 2>&1 | FileCheck --implicit-check-not=warning: %s11;; 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.12; RUN: lld-link /verbose /lldltocache:%t /lldltocachepolicy:prune_interval=0s:cache_size_files=3 /out:%t3 /entry:main %t2.o %t.o 2>&1 | FileCheck %s --implicit-check-not=warning:13;; 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.14; RUN: lld-link /lldltocache:%t /lldltocachepolicy:prune_interval=0s:cache_size_files=1 /out:%t3 /entry:main %t2.o %t.o 2>&1 | FileCheck %s --check-prefix=NUM15 16;; Check cache policies of the cache size.17;; Case 1: A value of 0 disables the absolute size-based pruning. Therefore, there is no warning.18; RUN: lld-link /verbose /lldltocache:%t /lldltocachepolicy:prune_interval=0s:cache_size_bytes=0 /out:%t3 /entry:main %t2.o %t.o 2>&1 | FileCheck %s --implicit-check-not=warning:19 20;; Get the total size of created cache files.21; RUN: rm -rf %t && mkdir %t && cd %t22; RUN: lld-link /lldltocache:%t /lldltocachepolicy:prune_interval=0s:cache_size_bytes=32k /out:%t3 /entry:main %t2.o %t.o 2>&123; 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.txt24 25;; 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.26; RUN: echo -n "/lldltocachepolicy:prune_interval=0s:cache_size_bytes=" > %t.response27; RUN: head -1 %t.size.txt >> %t.response28; RUN: lld-link /verbose /lldltocache:%t @%t.response /out:%t3 /entry:main %t2.o %t.o 2>&1 | FileCheck %s --implicit-check-not=warning:29 30;; 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.31; RUN: echo -n "/lldltocachepolicy:prune_interval=0s:cache_size_bytes=" > %t.response32; RUN: tail -1 %t.size.txt >> %t.response33; RUN: lld-link /verbose /lldltocache:%t @%t.response /out:%t3 /entry:main %t2.o %t.o 2>&1 | FileCheck %s --check-prefix=SIZE34 35;; Check emit two warnings if pruning happens due to reach both the size and number limits.36; RUN: lld-link /lldltocache:%t /lldltocachepolicy:prune_interval=0s:cache_size_files=1:cache_size_bytes=1 /out:%t3 /entry:main %t2.o %t.o 2>&1 | FileCheck %s --check-prefixes=NUM,SIZE37 38; NUM: warning: ThinLTO cache pruning happens since the number of{{.*}}--thinlto-cache-policy39; SIZE: warning: ThinLTO cache pruning happens since the total size of{{.*}}--thinlto-cache-policy40 41target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"42target triple = "x86_64-pc-windows-msvc"43 44define void @globalfunc() #0 {45entry:46 ret void47}48