xref: /llvm-project/llvm/test/Transforms/Inline/always-inline-phase-ordering.ll (revision 12c1156207e8c0d63701487f210ce90c4b7da938)
1; RUN: opt --Os -pass-remarks=inline -S < %s 2>&1 | FileCheck %s
2target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
3target triple = "arm64e-apple-macosx13"
4
5; CHECK: remark: <unknown>:0:0: 'wibble' inlined into 'bar.8' with (cost=always): always inline attribute
6; CHECK: remark: <unknown>:0:0: 'wibble' inlined into 'pluto' with (cost=always): always inline attribute
7; CHECK: remark: <unknown>:0:0: 'snork' inlined into 'blam' with (cost=always): always inline attribute
8; CHECK: remark: <unknown>:0:0: 'wobble' inlined into 'blam' with (cost=always): always inline attribute
9; CHECK: remark: <unknown>:0:0: 'spam' inlined into 'blam' with (cost=65, threshold=75)
10; CHECK: remark: <unknown>:0:0: 'wibble.1' inlined into 'widget' with (cost=30, threshold=75)
11; CHECK: remark: <unknown>:0:0: 'widget' inlined into 'bar.8' with (cost=30, threshold=75)
12; CHECK: remark: <unknown>:0:0: 'barney' inlined into 'wombat' with (cost=30, threshold=75)
13
14define linkonce_odr void @wombat(ptr %arg) #0 {
15bb:
16  call void @barney()
17  ret void
18}
19
20define i1 @foo() {
21bb:
22  call void @wombat(ptr null)
23  unreachable
24}
25
26define linkonce_odr void @pluto() #1 !prof !38 {
27bb:
28  call void @wibble()
29  ret void
30}
31
32; Function Attrs: alwaysinline
33define linkonce_odr void @wibble() #2 {
34bb:
35  call void @widget()
36  ret void
37}
38
39define linkonce_odr void @widget() {
40bb:
41  call void @wibble.1()
42  ret void
43}
44
45define linkonce_odr void @wibble.1() {
46bb:
47  %0 = call i32 @foo.2()
48  call void @blam()
49  ret void
50}
51
52declare i32 @foo.2()
53
54define linkonce_odr void @blam() {
55bb:
56  %tmp = call i32 @snork()
57  %tmpv1 = call ptr @wombat.3()
58  call void @eggs()
59  %tmpv2 = call ptr @wombat.3()
60  ret void
61}
62
63; Function Attrs: alwaysinline
64define linkonce_odr i32 @snork() #2 {
65bb:
66  %tmpv1 = call i32 @spam()
67  %tmpv2 = call i32 @wobble()
68  call void @widget.4(i32 %tmpv2)
69  ret i32 0
70}
71
72declare void @eggs()
73
74declare ptr @wombat.3()
75
76define linkonce_odr i32 @spam() {
77bb:
78  %tmpv1 = call i32 @wombat.6()
79  %tmpv2 = call i64 @wobble.5(i8 0)
80  %tmpv3 = call i64 @bar()
81  ret i32 0
82}
83
84; Function Attrs: alwaysinline
85define linkonce_odr i32 @wobble() #2 {
86bb:
87  %tmpv = call i64 @wobble.5(i8 0)
88  %tmpv1 = call i64 @eggs.7()
89  %tmpv2 = call i64 @wobble.5(i8 0)
90  %tmpv3 = call i64 @eggs.7()
91  %tmpv4 = lshr i64 %tmpv1, 1
92  %tmpv5 = trunc i64 %tmpv4 to i32
93  %tmpv6 = xor i32 %tmpv5, 23
94  ret i32 %tmpv6
95}
96
97declare void @widget.4(i32)
98
99declare i64 @bar()
100
101declare i64 @wobble.5(i8)
102
103declare i32 @wombat.6()
104
105declare i64 @eggs.7()
106
107define linkonce_odr void @barney() {
108bb:
109  call void @bar.8()
110  call void @pluto()
111  unreachable
112}
113
114define linkonce_odr void @bar.8() {
115bb:
116  call void @wibble()
117  ret void
118}
119
120attributes #0 = { "frame-pointer"="non-leaf" }
121attributes #1 = { "target-cpu"="apple-m1" }
122attributes #2 = { alwaysinline }
123
124!llvm.module.flags = !{!0, !1, !30, !31, !32, !36, !37}
125
126!0 = !{i32 2, !"SDK Version", [2 x i32] [i32 13, i32 3]}
127!1 = !{i32 1, !"ProfileSummary", !2}
128!2 = !{!3, !4, !5, !6, !7, !8, !9, !10, !11, !12}
129!3 = !{!"ProfileFormat", !"InstrProf"}
130!4 = !{!"TotalCount", i64 864540306756}
131!5 = !{!"MaxCount", i64 6596759955}
132!6 = !{!"MaxInternalCount", i64 2828618424}
133!7 = !{!"MaxFunctionCount", i64 6596759955}
134!8 = !{!"NumCounts", i64 268920}
135!9 = !{!"NumFunctions", i64 106162}
136!10 = !{!"IsPartialProfile", i64 0}
137!11 = !{!"PartialProfileRatio", double 0.000000e+00}
138!12 = !{!"DetailedSummary", !13}
139!13 = !{!14, !15, !16, !17, !18, !19, !20, !21, !22, !23, !24, !25, !26, !27, !28, !29}
140!14 = !{i32 10000, i64 5109654023, i32 2}
141!15 = !{i32 100000, i64 2480859832, i32 25}
142!16 = !{i32 200000, i64 1566552109, i32 70}
143!17 = !{i32 300000, i64 973667919, i32 140}
144!18 = !{i32 400000, i64 552159773, i32 263}
145!19 = !{i32 500000, i64 353879860, i32 463}
146!20 = !{i32 600000, i64 187122455, i32 799}
147!21 = !{i32 700000, i64 105465980, i32 1419}
148!22 = !{i32 800000, i64 49243829, i32 2620}
149!23 = !{i32 900000, i64 15198227, i32 5898}
150!24 = !{i32 950000, i64 5545670, i32 10696}
151!25 = !{i32 990000, i64 804816, i32 25738}
152!26 = !{i32 999000, i64 73999, i32 53382}
153!27 = !{i32 999900, i64 6530, i32 83503}
154!28 = !{i32 999990, i64 899, i32 110416}
155!29 = !{i32 999999, i64 120, i32 130201}
156!30 = !{i32 7, !"Dwarf Version", i32 4}
157!31 = !{i32 2, !"Debug Info Version", i32 3}
158!32 = !{i32 1, !"wchar_size", i32 4}
159!34 = !{!35}
160!35 = !{i32 0, i1 false}
161!36 = !{i32 8, !"PIC Level", i32 2}
162!37 = !{i32 7, !"frame-pointer", i32 1}
163!38 = !{!"function_entry_count", i64 15128150}
164