blob: 38fcc7e45996490391abedbc4718ad6145d16f01 [file] [log] [blame]
Dehao Chene5930492017-03-20 16:40:44 +00001; RUN: opt < %s -inline -S | FileCheck %s
2; Checks if inliner updates branch_weights annotation for call instructions.
3
4declare void @ext();
5declare void @ext1();
6
7; CHECK: define void @callee(i32 %n) !prof ![[ENTRY_COUNT:[0-9]*]]
8define void @callee(i32 %n) !prof !1 {
9 %cond = icmp sle i32 %n, 10
10 br i1 %cond, label %cond_true, label %cond_false
11cond_true:
12; ext1 is optimized away, thus not updated.
13; CHECK: call void @ext1(), !prof ![[COUNT_CALLEE1:[0-9]*]]
14 call void @ext1(), !prof !2
15 ret void
16cond_false:
17; ext is cloned and updated.
18; CHECK: call void @ext(), !prof ![[COUNT_CALLEE:[0-9]*]]
19 call void @ext(), !prof !2
20 ret void
21}
22
23; CHECK: define void @caller()
24define void @caller() {
25; CHECK: call void @ext(), !prof ![[COUNT_CALLER:[0-9]*]]
26 call void @callee(i32 15), !prof !3
27 ret void
28}
29
30!llvm.module.flags = !{!0}
31!0 = !{i32 1, !"MaxFunctionCount", i32 2000}
32!1 = !{!"function_entry_count", i64 1000}
33!2 = !{!"branch_weights", i64 2000}
34!3 = !{!"branch_weights", i64 400}
35attributes #0 = { alwaysinline }
36; CHECK: ![[ENTRY_COUNT]] = !{!"function_entry_count", i64 600}
37; CHECK: ![[COUNT_CALLEE1]] = !{!"branch_weights", i64 2000}
38; CHECK: ![[COUNT_CALLEE]] = !{!"branch_weights", i32 1200}
39; CHECK: ![[COUNT_CALLER]] = !{!"branch_weights", i32 800}