Eugene Leviant | bf46e74 | 2018-11-16 07:08:00 +0000 | [diff] [blame] | 1 | ; Check that we correctly handle 'ReadOnly' attribute when computing cache key |
| 2 | ; RUN: opt -module-summary -module-hash %s -o %t1.bc |
| 3 | ; RUN: opt -module-summary -module-hash %p/Inputs/index-const-prop-cache-foo.ll -o %t2.bc |
| 4 | ; RUN: opt -module-summary -module-hash %p/Inputs/index-const-prop-cache-test1.ll -o %t3.bc |
| 5 | ; RUN: opt -module-summary -module-hash %p/Inputs/index-const-prop-cache-test2.ll -o %t4.bc |
| 6 | ; RUN: rm -Rf %t.cache && mkdir %t.cache |
| 7 | |
| 8 | ; Here @gFoo variable is writeable |
| 9 | ; RUN: llvm-lto -thinlto-action=run %t1.bc %t4.bc %t2.bc \ |
| 10 | ; RUN: -exported-symbol=main -exported-symbol=test -thinlto-cache-dir=%t.cache |
| 11 | ; RUN: ls %t.cache/llvmcache-* | count 3 |
| 12 | |
| 13 | ; Now gFoo is read-only and all modules should get different cache keys. |
| 14 | ; RUN: llvm-lto -thinlto-action=run %t1.bc %t3.bc %t2.bc \ |
| 15 | ; RUN: -exported-symbol=main -exported-symbol=test -thinlto-cache-dir=%t.cache |
| 16 | ; RUN: ls %t.cache/llvmcache-* | count 6 |
| 17 | |
| 18 | ; Do the same but with llvm-lto2 |
| 19 | ; RUN: rm -Rf %t.cache && mkdir %t.cache |
| 20 | ; RUN: llvm-lto2 run %t1.bc %t4.bc %t2.bc -cache-dir=%t.cache -o %t5 \ |
| 21 | ; RUN: -r=%t1.bc,main,plx -r=%t1.bc,foo,l \ |
| 22 | ; RUN: -r=%t4.bc,test,plx -r=%t4.bc,foo,l -r=%t4.bc,bar,l \ |
| 23 | ; RUN: -r=%t2.bc,foo,pl -r=%t2.bc,bar,pl -r=%t2.bc,rand, |
| 24 | ; RUN: ls %t.cache/llvmcache-* | count 3 |
| 25 | |
| 26 | ; RUN: llvm-lto2 run %t1.bc %t3.bc %t2.bc -cache-dir %t.cache -o %t6 \ |
| 27 | ; RUN: -r=%t1.bc,main,plx -r=%t1.bc,foo,l \ |
| 28 | ; RUN: -r=%t3.bc,test,plx -r=%t3.bc,foo,l \ |
| 29 | ; RUN: -r=%t2.bc,foo,pl -r=%t2.bc,bar,pl -r=%t2.bc,rand, |
| 30 | ; RUN: ls %t.cache/llvmcache-* | count 6 |
| 31 | |
Amy Huang | 7b1d793 | 2019-09-10 23:15:38 +0000 | [diff] [blame] | 32 | target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" |
Eugene Leviant | bf46e74 | 2018-11-16 07:08:00 +0000 | [diff] [blame] | 33 | target triple = "x86_64-unknown-linux-gnu" |
| 34 | |
| 35 | ; Function Attrs: nounwind ssp uwtable |
| 36 | define i32 @main() local_unnamed_addr { |
| 37 | %1 = tail call i32 (...) @foo() |
| 38 | ret i32 %1 |
| 39 | } |
| 40 | |
| 41 | declare i32 @foo(...) local_unnamed_addr |