xref: /llvm-project/llvm/test/Transforms/FunctionImport/funcimport_forcecold_samplepgo.ll (revision a9af1b9a307780a39facd016c7329990d6cc5508)
1; Test to ensure that building summary with -force-summary-edges-cold
2; blocks importing as expected.
3
4; "-stats" and "-debug-only" require +Asserts.
5; REQUIRES: asserts
6
7; First do with default options, which should import
8; RUN: opt -module-summary %s -o %t.bc
9; RUN: opt -module-summary %p/Inputs/funcimport_forcecold.ll -o %t2.bc
10; RUN: llvm-lto -thinlto -o %t3 %t.bc %t2.bc
11; RUN: opt -passes=function-import -stats -print-imports -summary-file %t3.thinlto.bc %t.bc -S 2>&1 | FileCheck %s --check-prefix=IMPORT
12
13; Next rebuild caller module summary with only non-critical edges forced cold,
14; which should still import in this case.
15; RUN: opt -force-summary-edges-cold=all-non-critical -module-summary %s -o %t.bc
16; RUN: llvm-lto -thinlto -o %t3 %t.bc %t2.bc
17; RUN: opt -passes=function-import -stats -print-imports -summary-file %t3.thinlto.bc %t.bc -S 2>&1 | FileCheck %s --check-prefix=IMPORT
18
19; Next rebuild caller module summary with all edges forced cold.
20; Make sure we don't import.
21; RUN: opt -force-summary-edges-cold=all -module-summary %s -o %t.bc
22; RUN: llvm-lto -thinlto -o %t3 %t.bc %t2.bc
23; RUN: opt -passes=function-import -stats -print-imports -summary-file %t3.thinlto.bc %t.bc -S 2>&1 | FileCheck %s --check-prefix=NOIMPORT
24
25define i32 @main() !prof !1 {
26entry:
27  call void @foo()
28  ret i32 0
29}
30
31; IMPORT: Import foo
32; NOIMPORT-NOT: Import foo
33; IMPORT: define available_externally void @foo()
34; NOIMPORT: declare void @foo()
35declare void @foo()
36
37!1 = !{!"function_entry_count", i64 110, i64 6699318081062747564}
38