diff options
author | Mehdi Amini <mehdi.amini@apple.com> | 2016-10-08 04:44:23 +0000 |
---|---|---|
committer | Mehdi Amini <mehdi.amini@apple.com> | 2016-10-08 04:44:23 +0000 |
commit | ccef33b45b61ff5586394997ebdde1001230a36d (patch) | |
tree | cc67367c90a190d29b4724f638b431854261df7d /test/ThinLTO | |
parent | 7fe28f81dbac2aac6789f1519d41d739636809c2 (diff) | |
download | llvm-ccef33b45b61ff5586394997ebdde1001230a36d.tar.gz |
ThinLTO: don't perform incremental LTO on module without a hash
Clang always emit a hash for ThinLTO, but as other frontend are
starting to use ThinLTO, this could be a serious bug.
Differential Revision: https://reviews.llvm.org/D25379
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283655 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/ThinLTO')
-rw-r--r-- | test/ThinLTO/X86/cache.ll | 22 | ||||
-rw-r--r-- | test/ThinLTO/X86/empty_module_with_cache.ll | 4 |
2 files changed, 24 insertions, 2 deletions
diff --git a/test/ThinLTO/X86/cache.ll b/test/ThinLTO/X86/cache.ll index 239cfdf78dd7..b796b00fc5d5 100644 --- a/test/ThinLTO/X86/cache.ll +++ b/test/ThinLTO/X86/cache.ll @@ -1,6 +1,28 @@ +; Verify first that *without* hash, we don't use the cache. + ; RUN: opt -module-summary %s -o %t.bc ; RUN: opt -module-summary %p/Inputs/cache.ll -o %t2.bc +; Verify that enabling caching is ignoring module without hash +; RUN: rm -Rf %t.cache && mkdir %t.cache +; RUN: llvm-lto -thinlto-action=run -exported-symbol=globalfunc %t2.bc %t.bc -thinlto-cache-dir %t.cache +; RUN: ls %t.cache/llvmcache.timestamp +; RUN: ls %t.cache | count 1 + +; Verify that enabling caching is ignoring module without hash with llvm-lto2 +; RUN: rm -Rf %t.cache && mkdir %t.cache +; RUN: llvm-lto2 -o %t.o %t2.bc %t.bc -cache-dir %t.cache \ +; RUN: -r=%t2.bc,_main,plx \ +; RUN: -r=%t2.bc,_globalfunc,lx \ +; RUN: -r=%t.bc,_globalfunc,plx +; RUN: ls %t.cache | count 0 + + +; Repeat again, *with* hash this time. + +; RUN: opt -module-hash -module-summary %s -o %t.bc +; RUN: opt -module-hash -module-summary %p/Inputs/cache.ll -o %t2.bc + ; Verify that enabling caching is working ; RUN: rm -Rf %t.cache && mkdir %t.cache ; RUN: llvm-lto -thinlto-action=run -exported-symbol=globalfunc %t2.bc %t.bc -thinlto-cache-dir %t.cache diff --git a/test/ThinLTO/X86/empty_module_with_cache.ll b/test/ThinLTO/X86/empty_module_with_cache.ll index c62745156302..3e16c395a893 100644 --- a/test/ThinLTO/X86/empty_module_with_cache.ll +++ b/test/ThinLTO/X86/empty_module_with_cache.ll @@ -22,13 +22,13 @@ ; RUN: rm -Rf %t.cache && mkdir %t.cache ; RUN: llvm-lto -thinlto-action=run %t2.bc %t.bc -exported-symbol=main -thinlto-cache-dir %t.cache ; RUN: ls %t.cache/llvmcache.timestamp -; RUN: ls %t.cache | count 2 +; RUN: ls %t.cache | count 1 ; Verify that caching is disabled for module without hash, with llvm-lto2 ; RUN: rm -Rf %t.cache && mkdir %t.cache ; RUN: llvm-lto2 -o %t.o %t2.bc %t.bc -cache-dir %t.cache \ ; RUN: -r=%t2.bc,_main,plx -; RUN: ls %t.cache | count 1 +; RUN: ls %t.cache | count 0 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" |