|
23 | 23 | ; BFI_AFTER: - inner_loop_exit: {{.*}} count = 1000
|
24 | 24 | ; BFI_AFTER: - outer_loop_exit: {{.*}} count = 1
|
25 | 25 |
|
| 26 | +; IR-LABEL: define void @func0 |
26 | 27 | ; IR: inner_loop_body:
|
27 | 28 | ; IR: br i1 %cmp1, label %inner_loop_body, label %inner_loop_exit, !prof [[PROF_FUNC0_0:![0-9]+]]
|
28 | 29 | ; IR: inner_loop_exit:
|
@@ -74,6 +75,7 @@ outer_loop_exit:
|
74 | 75 | ; BFI_AFTER: - loop_header.loop_exit_crit_edge: {{.*}} count = 1024
|
75 | 76 | ; BFI_AFTER: - loop_exit: {{.*}} count = 1024
|
76 | 77 |
|
| 78 | +; IR-LABEL: define void @func1 |
77 | 79 | ; IR: entry:
|
78 | 80 | ; IR: br i1 %cmp1, label %loop_body.lr.ph, label %loop_exit, !prof [[PROF_FUNC1_0:![0-9]+]]
|
79 | 81 |
|
@@ -114,6 +116,7 @@ loop_exit:
|
114 | 116 | ; - loop_header.loop_exit_crit_edge: {{.*}} count = 32
|
115 | 117 | ; - loop_exit: {{.*}} count = 1024
|
116 | 118 |
|
| 119 | +; IR-LABEL: define void @func2 |
117 | 120 | ; IR: entry:
|
118 | 121 | ; IR: br i1 %cmp1, label %loop_exit, label %loop_body.lr.ph, !prof [[PROF_FUNC2_0:![0-9]+]]
|
119 | 122 |
|
@@ -141,16 +144,110 @@ loop_exit:
|
141 | 144 | ret void
|
142 | 145 | }
|
143 | 146 |
|
| 147 | +; BFI_BEFORE-LABEL: block-frequency-info: func3_zero_branch_weight |
| 148 | +; BFI_BEFORE: - entry: {{.*}} count = 1024 |
| 149 | +; BFI_BEFORE: - loop_header: {{.*}} count = 2199023255296 |
| 150 | +; BFI_BEFORE: - loop_body: {{.*}} count = 2199023254272 |
| 151 | +; BFI_BEFORE: - loop_exit: {{.*}} count = 1024 |
| 152 | + |
| 153 | +; BFI_AFTER-LABEL: block-frequency-info: func3_zero_branch_weight |
| 154 | +; BFI_AFTER: - entry: {{.*}} count = 1024 |
| 155 | +; BFI_AFTER: - loop_body.lr.ph: {{.*}} count = 1024 |
| 156 | +; BFI_AFTER: - loop_body: {{.*}} count = 2199023255296 |
| 157 | +; BFI_AFTER: - loop_header.loop_exit_crit_edge: {{.*}} count = 1024 |
| 158 | +; BFI_AFTER: - loop_exit: {{.*}} count = 1024 |
| 159 | + |
| 160 | +; IR-LABEL: define void @func3_zero_branch_weight |
| 161 | +; IR: entry: |
| 162 | +; IR: br i1 %cmp1, label %loop_exit, label %loop_body.lr.ph, !prof [[PROF_FUNC3_0:![0-9]+]] |
| 163 | + |
| 164 | +; IR: loop_body: |
| 165 | +; IR: br i1 %cmp, label %loop_header.loop_exit_crit_edge, label %loop_body, !prof [[PROF_FUNC3_0]] |
| 166 | + |
| 167 | +define void @func3_zero_branch_weight(i32 %n) !prof !3 { |
| 168 | +entry: |
| 169 | + br label %loop_header |
| 170 | + |
| 171 | +loop_header: |
| 172 | + %i = phi i32 [0, %entry], [%i_inc, %loop_body] |
| 173 | + %cmp = icmp slt i32 %i, %n |
| 174 | + br i1 %cmp, label %loop_exit, label %loop_body, !prof !6 |
| 175 | + |
| 176 | +loop_body: |
| 177 | + store volatile i32 %i, ptr @g, align 4 |
| 178 | + %i_inc = add i32 %i, 1 |
| 179 | + br label %loop_header |
| 180 | + |
| 181 | +loop_exit: |
| 182 | + ret void |
| 183 | +} |
| 184 | + |
| 185 | +; IR-LABEL: define void @func4_zero_branch_weight |
| 186 | +; IR: entry: |
| 187 | +; IR: br i1 %cmp1, label %loop_exit, label %loop_body.lr.ph, !prof [[PROF_FUNC4_0:![0-9]+]] |
| 188 | + |
| 189 | +; IR: loop_body: |
| 190 | +; IR: br i1 %cmp, label %loop_header.loop_exit_crit_edge, label %loop_body, !prof [[PROF_FUNC4_0]] |
| 191 | + |
| 192 | +define void @func4_zero_branch_weight(i32 %n) !prof !3 { |
| 193 | +entry: |
| 194 | + br label %loop_header |
| 195 | + |
| 196 | +loop_header: |
| 197 | + %i = phi i32 [0, %entry], [%i_inc, %loop_body] |
| 198 | + %cmp = icmp slt i32 %i, %n |
| 199 | + br i1 %cmp, label %loop_exit, label %loop_body, !prof !7 |
| 200 | + |
| 201 | +loop_body: |
| 202 | + store volatile i32 %i, ptr @g, align 4 |
| 203 | + %i_inc = add i32 %i, 1 |
| 204 | + br label %loop_header |
| 205 | + |
| 206 | +loop_exit: |
| 207 | + ret void |
| 208 | +} |
| 209 | + |
| 210 | +; IR-LABEL: define void @func5_zero_branch_weight |
| 211 | +; IR: entry: |
| 212 | +; IR: br i1 %cmp1, label %loop_exit, label %loop_body.lr.ph, !prof [[PROF_FUNC5_0:![0-9]+]] |
| 213 | + |
| 214 | +; IR: loop_body: |
| 215 | +; IR: br i1 %cmp, label %loop_header.loop_exit_crit_edge, label %loop_body, !prof [[PROF_FUNC5_0]] |
| 216 | + |
| 217 | +define void @func5_zero_branch_weight(i32 %n) !prof !3 { |
| 218 | +entry: |
| 219 | + br label %loop_header |
| 220 | + |
| 221 | +loop_header: |
| 222 | + %i = phi i32 [0, %entry], [%i_inc, %loop_body] |
| 223 | + %cmp = icmp slt i32 %i, %n |
| 224 | + br i1 %cmp, label %loop_exit, label %loop_body, !prof !8 |
| 225 | + |
| 226 | +loop_body: |
| 227 | + store volatile i32 %i, ptr @g, align 4 |
| 228 | + %i_inc = add i32 %i, 1 |
| 229 | + br label %loop_header |
| 230 | + |
| 231 | +loop_exit: |
| 232 | + ret void |
| 233 | +} |
| 234 | + |
144 | 235 | !0 = !{!"function_entry_count", i64 1}
|
145 | 236 | !1 = !{!"branch_weights", i32 1000, i32 1}
|
146 | 237 | !2 = !{!"branch_weights", i32 3000, i32 1000}
|
147 | 238 | !3 = !{!"function_entry_count", i64 1024}
|
148 | 239 | !4 = !{!"branch_weights", i32 40, i32 2}
|
149 | 240 | !5 = !{!"branch_weights", i32 10240, i32 320}
|
| 241 | +!6 = !{!"branch_weights", i32 0, i32 1} |
| 242 | +!7 = !{!"branch_weights", i32 1, i32 0} |
| 243 | +!8 = !{!"branch_weights", i32 0, i32 0} |
150 | 244 |
|
151 | 245 | ; IR: [[PROF_FUNC0_0]] = !{!"branch_weights", i32 2000, i32 1000}
|
152 | 246 | ; IR: [[PROF_FUNC0_1]] = !{!"branch_weights", i32 999, i32 1}
|
153 | 247 | ; IR: [[PROF_FUNC1_0]] = !{!"branch_weights", i32 127, i32 1}
|
154 | 248 | ; IR: [[PROF_FUNC1_1]] = !{!"branch_weights", i32 2433, i32 127}
|
155 | 249 | ; IR: [[PROF_FUNC2_0]] = !{!"branch_weights", i32 9920, i32 320}
|
156 | 250 | ; IR: [[PROF_FUNC2_1]] = !{!"branch_weights", i32 320, i32 0}
|
| 251 | +; IR: [[PROF_FUNC3_0]] = !{!"branch_weights", i32 0, i32 1} |
| 252 | +; IR: [[PROF_FUNC4_0]] = !{!"branch_weights", i32 1, i32 0} |
| 253 | +; IR: [[PROF_FUNC5_0]] = !{!"branch_weights", i32 0, i32 0} |
0 commit comments