1; REQUIRES: x86 2; NetBSD: noatime mounts currently inhibit 'touch' from updating atime 3; UNSUPPORTED: system-netbsd 4 5; RUN: opt -module-hash -module-summary %s -o %t.o 6; RUN: opt -module-hash -module-summary %p/Inputs/lto-cache.ll -o %t2.o 7 8; RUN: rm -Rf %t.cache && mkdir %t.cache 9; Create two files that would be removed by cache pruning due to age. 10; We should only remove files matching "llvmcache-*" or "Thin-*". 11; RUN: touch -t 197001011200 %t.cache/llvmcache-foo %t.cache/Thin-123.tmp.o %t.cache/foo 12; RUN: lld-link /lldltocache:%t.cache /lldltocachepolicy:prune_after=1h /out:%t3 /entry:main %t2.o %t.o 13 14; Two cached objects, plus a timestamp file and "foo", minus the file we removed. 15; RUN: ls %t.cache | count 4 16 17;; Check that mllvm options participate in the cache key 18; RUN: rm -rf %t.cache && mkdir %t.cache 19; RUN: lld-link /lldltocache:%t.cache /entry:main /out:%t3 %t2.o %t.o 20; RUN: ls %t.cache | count 3 21; RUN: lld-link /lldltocache:%t.cache /entry:main /out:%t3 %t2.o %t.o /mllvm:-enable-ml-inliner=default 22; RUN: ls %t.cache | count 5 23 24;; Adding another option resuls in 2 more cache entries 25; RUN: rm -rf %t.cache && mkdir %t.cache 26; RUN: lld-link /lldltocache:%t.cache /entry:main /out:%t3 %t2.o %t.o 27; RUN: ls %t.cache | count 3 28; RUN: lld-link /lldltocache:%t.cache /entry:main /out:%t3 %t2.o %t.o /mllvm:-enable-ml-inliner=default 29; RUN: ls %t.cache | count 5 30; RUN: lld-link /lldltocache:%t.cache /entry:main /out:%t3 %t2.o %t.o /mllvm:-enable-ml-inliner=default /mllvm:-max-devirt-iterations=1 31; RUN: ls %t.cache | count 7 32 33;; Changing order may matter - e.g. if overriding /mllvm:options - so we get 2 more entries 34; RUN: lld-link /lldltocache:%t.cache /entry:main /out:%t3 %t2.o %t.o /mllvm:-max-devirt-iterations=1 /mllvm:-enable-ml-inliner=default 35; RUN: ls %t.cache | count 9 36 37;; Going back to a pre-cached order doesn't create more entries. 38; RUN: lld-link /lldltocache:%t.cache /entry:main /out:%t3 %t2.o %t.o /mllvm:-enable-ml-inliner=default /mllvm:-max-devirt-iterations=1 39; RUN: ls %t.cache | count 9 40 41;; Different flag values matter 42; RUN: rm -rf %t.cache && mkdir %t.cache 43; RUN: lld-link /lldltocache:%t.cache /entry:main /out:%t3 %t2.o %t.o /mllvm:-enable-ml-inliner=default /mllvm:-max-devirt-iterations=2 44; RUN: ls %t.cache | count 3 45; RUN: lld-link /lldltocache:%t.cache /entry:main /out:%t3 %t2.o %t.o /mllvm:-enable-ml-inliner=default /mllvm:-max-devirt-iterations=1 46; RUN: ls %t.cache | count 5 47 48;; Same flag value passed to different flags matters, and switching the order 49;; of the two flags matters. 50; RUN: rm -rf %t.cache && mkdir %t.cache 51; RUN: lld-link /lldltocache:%t.cache /entry:main /out:%t3 %t2.o %t.o /mllvm:-enable-ml-inliner=default 52; RUN: ls %t.cache | count 3 53; RUN: lld-link /lldltocache:%t.cache /entry:main /out:%t3 %t2.o %t.o /mllvm:-emit-dwarf-unwind=default 54; RUN: ls %t.cache | count 5 55; RUN: lld-link /lldltocache:%t.cache /entry:main /out:%t3 %t2.o %t.o /mllvm:-enable-ml-inliner=default 56; RUN: ls %t.cache | count 5 57; RUN: lld-link /lldltocache:%t.cache /entry:main /out:%t3 %t2.o %t.o /mllvm:-enable-ml-inliner=default /mllvm:-emit-dwarf-unwind=default 58; RUN: ls %t.cache | count 7 59; RUN: lld-link /lldltocache:%t.cache /entry:main /out:%t3 %t2.o %t.o /mllvm:-emit-dwarf-unwind=default /mllvm:-enable-ml-inliner=default 60; RUN: ls %t.cache | count 9 61 62target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 63target triple = "x86_64-pc-windows-msvc" 64 65define void @globalfunc() #0 { 66entry: 67 ret void 68} 69