1cee313d2SEric Christopher; Do setup work for all below tests: generate bitcode and combined index
2cee313d2SEric Christopher; RUN: opt -module-summary %s -o %t.bc
3cee313d2SEric Christopher; RUN: opt -module-summary %p/Inputs/adjustable_threshold.ll -o %t2.bc
4cee313d2SEric Christopher; RUN: llvm-lto -thinlto -o %t3 %t.bc %t2.bc
5cee313d2SEric Christopher
6cee313d2SEric Christopher; Test import with default progressive instruction factor
7*2dcef019SSimon Pilgrim; RUN: opt -function-import -summary-file %t3.thinlto.bc %t.bc -import-instr-limit=10 -S | FileCheck %s --check-prefix=INSTLIM-DEFAULT
8cee313d2SEric Christopher; INSTLIM-DEFAULT: call void @staticfunc2.llvm.
9cee313d2SEric Christopher
10cee313d2SEric Christopher; Test import with a reduced progressive instruction factor
11*2dcef019SSimon Pilgrim; RUN: opt -function-import -summary-file %t3.thinlto.bc %t.bc -import-instr-limit=10 -import-instr-evolution-factor=0.5 -S | FileCheck %s --check-prefix=INSTLIM-PROGRESSIVE
12cee313d2SEric Christopher; INSTLIM-PROGRESSIVE-NOT: call void @staticfunc
13cee313d2SEric Christopher
14cee313d2SEric Christopher
15cee313d2SEric Christopher
16cee313d2SEric Christopherdeclare void @globalfunc1()
17cee313d2SEric Christopherdeclare void @globalfunc2()
18cee313d2SEric Christopher
19cee313d2SEric Christopherdefine void @entry() {
20cee313d2SEric Christopherentry:
21cee313d2SEric Christopher; Call site are processed in reversed order!
22cee313d2SEric Christopher
23cee313d2SEric Christopher; On the direct call, we reconsider @largefunction with a higher threshold and
24cee313d2SEric Christopher; import it
25cee313d2SEric Christopher  call void @globalfunc2()
26cee313d2SEric Christopher; When importing globalfunc1, the threshold was limited and @largefunction was
27cee313d2SEric Christopher; not imported.
28cee313d2SEric Christopher  call void @globalfunc1()
29cee313d2SEric Christopher  ret void
30cee313d2SEric Christopher}
31cee313d2SEric Christopher
32