xref: /llvm-project/llvm/test/Transforms/Inline/function-count-update-2.ll (revision cee313d288a4faf0355d76fb6e0e927e211d08a5)
1*cee313d2SEric Christopher; RUN: opt < %s -passes='require<profile-summary>,cgscc(inline)' -S | FileCheck %s
2*cee313d2SEric Christopher
3*cee313d2SEric Christopher; This tests that the function count of a callee gets correctly updated after it
4*cee313d2SEric Christopher; has been inlined into a two callsites.
5*cee313d2SEric Christopher
6*cee313d2SEric Christopher; CHECK: @callee() !prof [[COUNT:![0-9]+]]
7*cee313d2SEric Christopherdefine i32 @callee() !prof !1 {
8*cee313d2SEric Christopher  ret i32 0
9*cee313d2SEric Christopher}
10*cee313d2SEric Christopher
11*cee313d2SEric Christopherdefine i32 @caller1() !prof !2 {
12*cee313d2SEric Christopher; CHECK-LABEL: @caller1
13*cee313d2SEric Christopher; CHECK-NOT: callee
14*cee313d2SEric Christopher; CHECK: ret
15*cee313d2SEric Christopher  %i = call i32 @callee()
16*cee313d2SEric Christopher  ret i32 %i
17*cee313d2SEric Christopher}
18*cee313d2SEric Christopher
19*cee313d2SEric Christopherdefine i32 @caller2() !prof !3 {
20*cee313d2SEric Christopher; CHECK-LABEL: @caller2
21*cee313d2SEric Christopher; CHECK-NOT: callee
22*cee313d2SEric Christopher; CHECK: ret
23*cee313d2SEric Christopher  %i = call i32 @callee()
24*cee313d2SEric Christopher  ret i32 %i
25*cee313d2SEric Christopher}
26*cee313d2SEric Christopher
27*cee313d2SEric Christopher!llvm.module.flags = !{!0}
28*cee313d2SEric Christopher; CHECK: [[COUNT]] = !{!"function_entry_count", i64 0}
29*cee313d2SEric Christopher!0 = !{i32 1, !"MaxFunctionCount", i32 1000}
30*cee313d2SEric Christopher!1 = !{!"function_entry_count", i64 1000}
31*cee313d2SEric Christopher!2 = !{!"function_entry_count", i64 600}
32*cee313d2SEric Christopher!3 = !{!"function_entry_count", i64 400}
33*cee313d2SEric Christopher
34