xref: /llvm-project/llvm/test/Transforms/Inline/optimization-remarks-with-hotness.ll (revision e5369823bc0655806469724335d0ca5a4c17d8c7)
1; RUN: opt < %s -passes=inline -pass-remarks=inline -pass-remarks-missed=inline \
2; RUN:     -pass-remarks-analysis=inline -pass-remarks-with-hotness -S 2>&1 \
3; RUN:     | FileCheck %s
4; RUN: opt < %s -passes=inline -pass-remarks=inline -pass-remarks-missed=inline \
5; RUN:     -pass-remarks-analysis=inline -pass-remarks-with-hotness -S 2>&1 \
6; RUN:     | FileCheck %s
7; RUN: opt < %s -passes=inliner-wrapper-no-mandatory-first -pass-remarks=inline -pass-remarks-missed=inline \
8; RUN:     -pass-remarks-analysis=inline -pass-remarks-with-hotness -S 2>&1 \
9; RUN:     | FileCheck %s
10
11; CHECK: 'foo' inlined into 'bar' with (cost=always): always inline attribute (hotness: 30)
12; CHECK: 'foz' not inlined into 'bar' because it should never be inlined (cost=never): noinline function attribute (hotness: 30)
13
14; Function Attrs: alwaysinline nounwind uwtable
15define i32 @foo() #0 !prof !1 {
16entry:
17  ret i32 4
18}
19
20; Function Attrs: noinline nounwind uwtable
21define i32 @foz() #1 !prof !2 {
22entry:
23  ret i32 2
24}
25
26; Function Attrs: nounwind uwtable
27define i32 @bar() !prof !3 {
28entry:
29  %call = call i32 @foo()
30  %call2 = call i32 @foz()
31  %mul = mul i32 %call, %call2
32  ret i32 %mul
33}
34
35attributes #0 = { alwaysinline }
36attributes #1 = { noinline }
37
38!llvm.ident = !{!0}
39
40!0 = !{!"clang version 3.5.0 "}
41!1 = !{!"function_entry_count", i64 10}
42!2 = !{!"function_entry_count", i64 20}
43!3 = !{!"function_entry_count", i64 30}
44