xref: /llvm-project/llvm/test/ThinLTO/X86/empty_module_with_cache.ll (revision 6b92bb47901f3a2d4a9aa683b0365088113a729e)
100fa1409SMehdi Amini; RUN: opt -module-hash -module-summary %s -o %t.bc
200fa1409SMehdi Amini; RUN: opt -module-hash -module-summary %p/Inputs/empty_module_with_cache.ll -o %t2.bc
300fa1409SMehdi Amini
400fa1409SMehdi Amini; Verify that enabling caching is working, even if the module is empty
500fa1409SMehdi Amini; RUN: rm -Rf %t.cache && mkdir %t.cache
600fa1409SMehdi Amini; RUN: llvm-lto -thinlto-action=run %t2.bc  %t.bc -exported-symbol=main -thinlto-cache-dir %t.cache
700fa1409SMehdi Amini; RUN: ls %t.cache/llvmcache.timestamp
800fa1409SMehdi Amini; RUN: ls %t.cache | count 3
900fa1409SMehdi Amini
1000fa1409SMehdi Amini; Verify that enabling caching is working with llvm-lto2
11ab76a19aSPeter Collingbourne; RUN: rm -Rf %t.cache
127faa60c4SPeter Collingbourne; RUN: llvm-lto2 run -o %t.o %t2.bc  %t.bc -cache-dir %t.cache \
1300fa1409SMehdi Amini; RUN:  -r=%t2.bc,_main,plx
1400fa1409SMehdi Amini; RUN: ls %t.cache | count 2
1500fa1409SMehdi Amini
1600fa1409SMehdi Amini; Same, but without hash, the index will be empty and caching should not happen
1700fa1409SMehdi Amini
1800fa1409SMehdi Amini; RUN: opt -module-summary %s -o %t.bc
1900fa1409SMehdi Amini; RUN: opt -module-summary %p/Inputs/empty_module_with_cache.ll -o %t2.bc
2000fa1409SMehdi Amini
2100fa1409SMehdi Amini; Verify that caching is disabled for module without hash
2200fa1409SMehdi Amini; RUN: rm -Rf %t.cache && mkdir %t.cache
2300fa1409SMehdi Amini; RUN: llvm-lto -thinlto-action=run %t2.bc  %t.bc -exported-symbol=main -thinlto-cache-dir %t.cache
2400fa1409SMehdi Amini; RUN: ls %t.cache/llvmcache.timestamp
25f82bda0aSMehdi Amini; RUN: ls %t.cache | count 1
2600fa1409SMehdi Amini
2700fa1409SMehdi Amini; Verify that caching is disabled for module without hash, with llvm-lto2
28ab76a19aSPeter Collingbourne; RUN: rm -Rf %t.cache
297faa60c4SPeter Collingbourne; RUN: llvm-lto2 run -o %t.o %t2.bc  %t.bc -cache-dir %t.cache \
3000fa1409SMehdi Amini; RUN:  -r=%t2.bc,_main,plx
31*6b92bb47SDaniel Thornburgh; RUN: not ls %t.cache
3200fa1409SMehdi Amini
3300fa1409SMehdi Amini
347b1d7937SAmy Huangtarget datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
3500fa1409SMehdi Aminitarget triple = "x86_64-apple-macosx10.11.0"
36