17
17
; _Z5funcAi:1 @ _Z8funcLeafi
18
18
; _Z5funcBi:1 @ _Z8funcLeafi
19
19
20
+ ; Test the functions won't be inlined as a result of sampled profile if `disable-sample-loader-inlining` is true.
21
+ ;
22
+ ; RUN: opt < %s -passes=sample-profile -sample-profile-file=%S/Inputs/profile-context-tracker.prof -sample-profile-inline-size -sample-profile-prioritized-inline=0 -profile-sample-accurate -disable-sample-loader-inlining -S | FileCheck %s --check-prefix=INLINE-NONE
23
+ ; RUN: opt < %s -passes=sample-profile -sample-profile-file=%t -sample-profile-inline-size -sample-profile-prioritized-inline=0 -profile-sample-accurate -disable-sample-loader-inlining -S | FileCheck %s --check-prefix=INLINE-NONE
24
+ ; RUN: opt < %s -passes=sample-profile -sample-profile-file=%S/Inputs/profile-context-tracker.prof -sample-profile-inline-size -sample-profile-cold-inline-threshold=200 -profile-sample-accurate -disable-sample-loader-inlining -S | FileCheck %s --check-prefix=INLINE-NONE
25
+ ; RUN: opt < %s -passes=sample-profile -sample-profile-file=%t -sample-profile-inline-size -sample-profile-cold-inline-threshold=200 -profile-sample-accurate -disable-sample-loader-inlining -S | FileCheck %s --check-prefix=INLINE-NONE
26
+
20
27
21
28
@factor = dso_local global i32 3 , align 4 , !dbg !0
22
29
23
30
define dso_local i32 @main () local_unnamed_addr #0 !dbg !18 {
24
31
; INLINE-ALL: @main{{.*}}!prof ![[MAIN_PROF:[0-9]+]]
25
32
; INLINE-HOT: @main{{.*}}!prof ![[MAIN_PROF:[0-9]+]]
33
+ ; INLINE-NONE: @main{{.*}}!prof ![[MAIN_PROF:[0-9]+]]
26
34
entry:
27
35
br label %for.body , !dbg !25
28
36
@@ -36,10 +44,16 @@ for.body: ; preds = %for.body, %entry
36
44
; _Z5funcBi is marked noinline
37
45
; INLINE-ALL: call i32 @_Z5funcBi
38
46
; INLINE-HOT: call i32 @_Z5funcBi
47
+ ;
48
+ ; _Z5funcBi isn't inlined since disable-sample-loader-inlining is true.
49
+ ; INLINE-NONE: call i32 @_Z5funcBi
39
50
%add = add nuw nsw i32 %x.011 , 1 , !dbg !31
40
51
%call1 = tail call i32 @_Z5funcAi (i32 %add ), !dbg !28
41
52
; INLINE-ALL-NOT: call i32 @_Z5funcAi
42
53
; INLINE-HOT: call i32 @_Z5funcAi
54
+ ;
55
+ ; _Z5funcAi is not inlined since `disable-sample-loader-inlining` is true.
56
+ ; INLINE-NONE: call i32 @_Z5funcAi
43
57
%add2 = add i32 %call , %r.010 , !dbg !34
44
58
%add3 = add i32 %add2 , %call1 , !dbg !35
45
59
%dec = add nsw i32 %x.011 , -1 , !dbg !36
@@ -51,13 +65,17 @@ define dso_local i32 @_Z5funcAi(i32 %x) local_unnamed_addr #1 !dbg !40 {
51
65
; _Z5funcAi is inlined, so outline remainder should have zero counts
52
66
; INLINE-ALL: @_Z5funcAi{{.*}}!prof ![[FUNCA_PROF:[0-9]+]]
53
67
; INLINE-HOT: @_Z5funcAi{{.*}}!prof ![[FUNCA_PROF:[0-9]+]]
68
+ ; INLINE-NONE: @_Z5funcAi{{.*}}!prof ![[FUNCA_PROF:[0-9]+]]
54
69
entry:
55
70
%add = add nsw i32 %x , 100000 , !dbg !44
56
71
; _Z8funcLeafi is already inlined on main->_Z5funcAi->_Z8funcLeafi,
57
72
; so it should not be inlined on _Z5funcAi->_Z8funcLeafi based on updated
58
73
; (merged and promoted) context profile
59
74
; INLINE-ALL: call i32 @_Z8funcLeafi
60
75
; INLINE-HOT-NOT: call i32 @_Z8funcLeafi
76
+ ;
77
+ ; `_Z8funcLeafi` isn't inlined if `disable-sample-loader-inlining` is true.
78
+ ; INLINE-NONE: call i32 @_Z8funcLeafi
61
79
%call = tail call i32 @_Z8funcLeafi (i32 %add ), !dbg !45
62
80
ret i32 %call , !dbg !46
63
81
}
@@ -67,6 +85,9 @@ define dso_local i32 @_Z8funcLeafi(i32 %x) local_unnamed_addr #1 !dbg !54 {
67
85
; inlined, so outline remainder should have empty profile
68
86
; INLINE-ALL: @_Z8funcLeafi{{.*}}!prof ![[LEAF_PROF:[0-9]+]]
69
87
; INLINE-HOT: @_Z8funcLeafi{{.*}}!prof ![[LEAF_PROF:[0-9]+]]
88
+ ;
89
+ ; _Z8funcLeafi won't be inlined if `disable-sample-loader-inlining` is true.
90
+ ; INLINE-NONE: @_Z8funcLeafi{{.*}}!prof ![[LEAF_PROF:[0-9]+]]
70
91
entry:
71
92
%cmp = icmp sgt i32 %x , 0 , !dbg !57
72
93
br i1 %cmp , label %while.body , label %while.cond2.preheader , !dbg !59
@@ -100,13 +121,17 @@ define dso_local i32 @_Z5funcBi(i32 %x) local_unnamed_addr #0 !dbg !47 {
100
121
; _Z5funcBi is marked noinline, so outline remainder has promoted context profile
101
122
; INLINE-ALL: @_Z5funcBi{{.*}}!prof ![[FUNCB_PROF:[0-9]+]]
102
123
; INLINE-HOT: @_Z5funcBi{{.*}}!prof ![[FUNCB_PROF:[0-9]+]]
124
+ ; _Z5funcBi won't be inlined since `disable-sample-loader-inlining` is true.
125
+ ; INLINE-NONE: @_Z5funcBi{{.*}}!prof ![[FUNCB_PROF:[0-9]+]]
103
126
entry:
104
127
%sub = add nsw i32 %x , -100000 , !dbg !51
105
128
%call = tail call i32 @_Z8funcLeafi (i32 %sub ), !dbg !52
106
129
; _Z5funcBi is not inlined into main, so we main->_Z5funcBi->_Z8funcLeafi
107
130
; should be inlined based on promoted context profile
108
131
; INLINE-ALL-NOT: call i32 @_Z8funcLeafi
109
132
; INLINE-HOT-NOT: call i32 @_Z8funcLeafi
133
+ ;
134
+ ; INLINE-NONE: call i32 @_Z8funcLeafi
110
135
ret i32 %call , !dbg !53
111
136
}
112
137
@@ -120,6 +145,11 @@ entry:
120
145
; INLINE-HOT-DAG-SAME: [[LEAF_PROF]] = !{!"function_entry_count", i64 0}
121
146
; INLINE-HOT-DAG: [[FUNCB_PROF]] = !{!"function_entry_count", i64 13}
122
147
148
+ ; INLINE-NONE: [[MAIN_PROF]] = !{!"function_entry_count", i64 1}
149
+ ; INLINE-NONE: [[FUNCA_PROF]] = !{!"function_entry_count", i64 24}
150
+ ; INLINE-NONE-DAG-SAME: [[LEAF_PROF]] = !{!"function_entry_count", i64 22}
151
+ ; INLINE-NONE-DAG: [[FUNCB_PROF]] = !{!"function_entry_count", i64 32}
152
+
123
153
declare i32 @_Z3fibi (i32 )
124
154
125
155
attributes #0 = { nofree noinline norecurse nounwind uwtable "correctly-rounded-divide-sqrt-fp-math" ="false" "disable-tail-calls" ="false" "frame-pointer" ="none" "less-precise-fpmad" ="false" "min-legal-vector-width" ="0" "no-infs-fp-math" ="false" "no-jump-tables" ="false" "no-nans-fp-math" ="false" "no-signed-zeros-fp-math" ="false" "no-trapping-math" ="false" "stack-protector-buffer-size" ="8" "target-cpu" ="x86-64" "target-features" ="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math" ="false" "use-soft-float" ="false" "use-sample-profile" }
0 commit comments