1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
2 ; RUN: opt < %s -passes='function(lower-allow-check)' -S | FileCheck %s --check-prefixes=NOPROFILE
3 ; RUN: opt < %s -passes='function(lower-allow-check)' -lower-allow-check-random-rate=0 -S | FileCheck %s --check-prefixes=NONE
4 ; RUN: opt < %s -passes='require<profile-summary>,function(lower-allow-check)' -lower-allow-check-percentile-cutoff-hot=990000 -S | FileCheck %s --check-prefixes=HOT99
5 ; RUN: opt < %s -passes='require<profile-summary>,function(lower-allow-check)' -lower-allow-check-percentile-cutoff-hot=700000 -S | FileCheck %s --check-prefixes=HOT70
7 target triple = "x86_64-pc-linux-gnu"
9 declare void @llvm.ubsantrap(i8 immarg)
10 declare i1 @llvm.allow.ubsan.check(i8 immarg)
12 define dso_local noundef i32 @simple(ptr noundef readonly %0) {
13 ; NOPROFILE-LABEL: define dso_local noundef i32 @simple(
14 ; NOPROFILE-SAME: ptr noundef readonly [[TMP0:%.*]]) {
15 ; NOPROFILE-NEXT: [[TMP2:%.*]] = icmp eq ptr [[TMP0]], null
16 ; NOPROFILE-NEXT: [[HOT:%.*]] = xor i1 true, true
17 ; NOPROFILE-NEXT: [[TMP6:%.*]] = or i1 [[TMP2]], [[HOT]]
18 ; NOPROFILE-NEXT: br i1 [[TMP6]], label [[TMP3:%.*]], label [[TMP4:%.*]]
20 ; NOPROFILE-NEXT: tail call void @llvm.ubsantrap(i8 22)
21 ; NOPROFILE-NEXT: unreachable
23 ; NOPROFILE-NEXT: [[TMP5:%.*]] = load i32, ptr [[TMP0]], align 4
24 ; NOPROFILE-NEXT: ret i32 [[TMP5]]
26 ; NONE-LABEL: define dso_local noundef i32 @simple(
27 ; NONE-SAME: ptr noundef readonly [[TMP0:%.*]]) {
28 ; NONE-NEXT: [[TMP2:%.*]] = icmp eq ptr [[TMP0]], null
29 ; NONE-NEXT: [[HOT:%.*]] = xor i1 false, true
30 ; NONE-NEXT: [[TMP6:%.*]] = or i1 [[TMP2]], [[HOT]]
31 ; NONE-NEXT: br i1 [[TMP6]], label [[TMP3:%.*]], label [[TMP4:%.*]]
33 ; NONE-NEXT: tail call void @llvm.ubsantrap(i8 22)
34 ; NONE-NEXT: unreachable
36 ; NONE-NEXT: [[TMP5:%.*]] = load i32, ptr [[TMP0]], align 4
37 ; NONE-NEXT: ret i32 [[TMP5]]
39 ; HOT99-LABEL: define dso_local noundef i32 @simple(
40 ; HOT99-SAME: ptr noundef readonly [[TMP0:%.*]]) {
41 ; HOT99-NEXT: [[TMP2:%.*]] = icmp eq ptr [[TMP0]], null
42 ; HOT99-NEXT: [[HOT:%.*]] = xor i1 true, true
43 ; HOT99-NEXT: [[TMP6:%.*]] = or i1 [[TMP2]], [[HOT]]
44 ; HOT99-NEXT: br i1 [[TMP6]], label [[TMP3:%.*]], label [[TMP4:%.*]]
46 ; HOT99-NEXT: tail call void @llvm.ubsantrap(i8 22)
47 ; HOT99-NEXT: unreachable
49 ; HOT99-NEXT: [[TMP5:%.*]] = load i32, ptr [[TMP0]], align 4
50 ; HOT99-NEXT: ret i32 [[TMP5]]
52 ; HOT70-LABEL: define dso_local noundef i32 @simple(
53 ; HOT70-SAME: ptr noundef readonly [[TMP0:%.*]]) {
54 ; HOT70-NEXT: [[TMP2:%.*]] = icmp eq ptr [[TMP0]], null
55 ; HOT70-NEXT: [[HOT:%.*]] = xor i1 true, true
56 ; HOT70-NEXT: [[TMP6:%.*]] = or i1 [[TMP2]], [[HOT]]
57 ; HOT70-NEXT: br i1 [[TMP6]], label [[TMP3:%.*]], label [[TMP4:%.*]]
59 ; HOT70-NEXT: tail call void @llvm.ubsantrap(i8 22)
60 ; HOT70-NEXT: unreachable
62 ; HOT70-NEXT: [[TMP5:%.*]] = load i32, ptr [[TMP0]], align 4
63 ; HOT70-NEXT: ret i32 [[TMP5]]
65 %chk = icmp eq ptr %0, null
66 %allow = call i1 @llvm.allow.ubsan.check(i8 22)
67 %hot = xor i1 %allow, true
69 br i1 %2, label %3, label %4
72 tail call void @llvm.ubsantrap(i8 22)
76 %5 = load i32, ptr %0, align 4
81 define dso_local noundef i32 @hot(ptr noundef readonly %0) !prof !36 {
82 ; NOPROFILE-LABEL: define dso_local noundef i32 @hot(
83 ; NOPROFILE-SAME: ptr noundef readonly [[TMP0:%.*]]) !prof [[PROF16:![0-9]+]] {
84 ; NOPROFILE-NEXT: [[TMP2:%.*]] = icmp eq ptr [[TMP0]], null
85 ; NOPROFILE-NEXT: [[HOT:%.*]] = xor i1 true, true
86 ; NOPROFILE-NEXT: [[TMP6:%.*]] = or i1 [[TMP2]], [[HOT]]
87 ; NOPROFILE-NEXT: br i1 [[TMP6]], label [[TMP3:%.*]], label [[TMP4:%.*]]
89 ; NOPROFILE-NEXT: tail call void @llvm.ubsantrap(i8 22)
90 ; NOPROFILE-NEXT: unreachable
92 ; NOPROFILE-NEXT: [[TMP5:%.*]] = load i32, ptr [[TMP0]], align 4
93 ; NOPROFILE-NEXT: ret i32 [[TMP5]]
95 ; NONE-LABEL: define dso_local noundef i32 @hot(
96 ; NONE-SAME: ptr noundef readonly [[TMP0:%.*]]) !prof [[PROF16:![0-9]+]] {
97 ; NONE-NEXT: [[TMP2:%.*]] = icmp eq ptr [[TMP0]], null
98 ; NONE-NEXT: [[HOT:%.*]] = xor i1 false, true
99 ; NONE-NEXT: [[TMP6:%.*]] = or i1 [[TMP2]], [[HOT]]
100 ; NONE-NEXT: br i1 [[TMP6]], label [[TMP3:%.*]], label [[TMP4:%.*]]
102 ; NONE-NEXT: tail call void @llvm.ubsantrap(i8 22)
103 ; NONE-NEXT: unreachable
105 ; NONE-NEXT: [[TMP5:%.*]] = load i32, ptr [[TMP0]], align 4
106 ; NONE-NEXT: ret i32 [[TMP5]]
108 ; HOT99-LABEL: define dso_local noundef i32 @hot(
109 ; HOT99-SAME: ptr noundef readonly [[TMP0:%.*]]) !prof [[PROF16:![0-9]+]] {
110 ; HOT99-NEXT: [[TMP2:%.*]] = icmp eq ptr [[TMP0]], null
111 ; HOT99-NEXT: [[HOT:%.*]] = xor i1 false, true
112 ; HOT99-NEXT: [[TMP6:%.*]] = or i1 [[TMP2]], [[HOT]]
113 ; HOT99-NEXT: br i1 [[TMP6]], label [[TMP3:%.*]], label [[TMP4:%.*]]
115 ; HOT99-NEXT: tail call void @llvm.ubsantrap(i8 22)
116 ; HOT99-NEXT: unreachable
118 ; HOT99-NEXT: [[TMP5:%.*]] = load i32, ptr [[TMP0]], align 4
119 ; HOT99-NEXT: ret i32 [[TMP5]]
121 ; HOT70-LABEL: define dso_local noundef i32 @hot(
122 ; HOT70-SAME: ptr noundef readonly [[TMP0:%.*]]) !prof [[PROF16:![0-9]+]] {
123 ; HOT70-NEXT: [[TMP2:%.*]] = icmp eq ptr [[TMP0]], null
124 ; HOT70-NEXT: [[HOT:%.*]] = xor i1 true, true
125 ; HOT70-NEXT: [[TMP6:%.*]] = or i1 [[TMP2]], [[HOT]]
126 ; HOT70-NEXT: br i1 [[TMP6]], label [[TMP3:%.*]], label [[TMP4:%.*]]
128 ; HOT70-NEXT: tail call void @llvm.ubsantrap(i8 22)
129 ; HOT70-NEXT: unreachable
131 ; HOT70-NEXT: [[TMP5:%.*]] = load i32, ptr [[TMP0]], align 4
132 ; HOT70-NEXT: ret i32 [[TMP5]]
134 %chk = icmp eq ptr %0, null
135 %allow = call i1 @llvm.allow.ubsan.check(i8 22)
136 %hot = xor i1 %allow, true
137 %2 = or i1 %chk, %hot
138 br i1 %2, label %3, label %4
141 tail call void @llvm.ubsantrap(i8 22)
145 %5 = load i32, ptr %0, align 4
149 define dso_local noundef i32 @veryHot(ptr noundef readonly %0) !prof !39 {
150 ; NOPROFILE-LABEL: define dso_local noundef i32 @veryHot(
151 ; NOPROFILE-SAME: ptr noundef readonly [[TMP0:%.*]]) !prof [[PROF17:![0-9]+]] {
152 ; NOPROFILE-NEXT: [[TMP2:%.*]] = icmp eq ptr [[TMP0]], null
153 ; NOPROFILE-NEXT: [[HOT:%.*]] = xor i1 true, true
154 ; NOPROFILE-NEXT: [[TMP6:%.*]] = or i1 [[TMP2]], [[HOT]]
155 ; NOPROFILE-NEXT: br i1 [[TMP6]], label [[TMP3:%.*]], label [[TMP4:%.*]]
157 ; NOPROFILE-NEXT: tail call void @llvm.ubsantrap(i8 22)
158 ; NOPROFILE-NEXT: unreachable
160 ; NOPROFILE-NEXT: [[TMP5:%.*]] = load i32, ptr [[TMP0]], align 4
161 ; NOPROFILE-NEXT: ret i32 [[TMP5]]
163 ; NONE-LABEL: define dso_local noundef i32 @veryHot(
164 ; NONE-SAME: ptr noundef readonly [[TMP0:%.*]]) !prof [[PROF17:![0-9]+]] {
165 ; NONE-NEXT: [[TMP2:%.*]] = icmp eq ptr [[TMP0]], null
166 ; NONE-NEXT: [[HOT:%.*]] = xor i1 false, true
167 ; NONE-NEXT: [[TMP6:%.*]] = or i1 [[TMP2]], [[HOT]]
168 ; NONE-NEXT: br i1 [[TMP6]], label [[TMP3:%.*]], label [[TMP4:%.*]]
170 ; NONE-NEXT: tail call void @llvm.ubsantrap(i8 22)
171 ; NONE-NEXT: unreachable
173 ; NONE-NEXT: [[TMP5:%.*]] = load i32, ptr [[TMP0]], align 4
174 ; NONE-NEXT: ret i32 [[TMP5]]
176 ; HOT99-LABEL: define dso_local noundef i32 @veryHot(
177 ; HOT99-SAME: ptr noundef readonly [[TMP0:%.*]]) !prof [[PROF17:![0-9]+]] {
178 ; HOT99-NEXT: [[TMP2:%.*]] = icmp eq ptr [[TMP0]], null
179 ; HOT99-NEXT: [[HOT:%.*]] = xor i1 false, true
180 ; HOT99-NEXT: [[TMP6:%.*]] = or i1 [[TMP2]], [[HOT]]
181 ; HOT99-NEXT: br i1 [[TMP6]], label [[TMP3:%.*]], label [[TMP4:%.*]]
183 ; HOT99-NEXT: tail call void @llvm.ubsantrap(i8 22)
184 ; HOT99-NEXT: unreachable
186 ; HOT99-NEXT: [[TMP5:%.*]] = load i32, ptr [[TMP0]], align 4
187 ; HOT99-NEXT: ret i32 [[TMP5]]
189 ; HOT70-LABEL: define dso_local noundef i32 @veryHot(
190 ; HOT70-SAME: ptr noundef readonly [[TMP0:%.*]]) !prof [[PROF17:![0-9]+]] {
191 ; HOT70-NEXT: [[TMP2:%.*]] = icmp eq ptr [[TMP0]], null
192 ; HOT70-NEXT: [[HOT:%.*]] = xor i1 false, true
193 ; HOT70-NEXT: [[TMP6:%.*]] = or i1 [[TMP2]], [[HOT]]
194 ; HOT70-NEXT: br i1 [[TMP6]], label [[TMP3:%.*]], label [[TMP4:%.*]]
196 ; HOT70-NEXT: tail call void @llvm.ubsantrap(i8 22)
197 ; HOT70-NEXT: unreachable
199 ; HOT70-NEXT: [[TMP5:%.*]] = load i32, ptr [[TMP0]], align 4
200 ; HOT70-NEXT: ret i32 [[TMP5]]
202 %chk = icmp eq ptr %0, null
203 %allow = call i1 @llvm.allow.ubsan.check(i8 22)
204 %hot = xor i1 %allow, true
205 %2 = or i1 %chk, %hot
206 br i1 %2, label %3, label %4
209 tail call void @llvm.ubsantrap(i8 22)
213 %5 = load i32, ptr %0, align 4
218 define dso_local noundef i32 @branchColdFnHot(i32 noundef %0, ptr noundef readonly %1) !prof !39 {
219 ; NOPROFILE-LABEL: define dso_local noundef i32 @branchColdFnHot(
220 ; NOPROFILE-SAME: i32 noundef [[TMP0:%.*]], ptr noundef readonly [[TMP1:%.*]]) !prof [[PROF17]] {
221 ; NOPROFILE-NEXT: [[TMP3:%.*]] = icmp eq i32 [[TMP0]], 0
222 ; NOPROFILE-NEXT: br i1 [[TMP3]], label [[TMP9:%.*]], label [[TMP4:%.*]], !prof [[PROF18:![0-9]+]]
224 ; NOPROFILE-NEXT: [[TMP5:%.*]] = icmp eq ptr [[TMP1]], null
225 ; NOPROFILE-NEXT: [[HOT:%.*]] = xor i1 true, true
226 ; NOPROFILE-NEXT: [[TMP11:%.*]] = or i1 [[TMP5]], [[HOT]]
227 ; NOPROFILE-NEXT: br i1 [[TMP11]], label [[TMP6:%.*]], label [[TMP7:%.*]]
229 ; NOPROFILE-NEXT: tail call void @llvm.ubsantrap(i8 22)
230 ; NOPROFILE-NEXT: unreachable
232 ; NOPROFILE-NEXT: [[TMP8:%.*]] = load i32, ptr [[TMP1]], align 4
233 ; NOPROFILE-NEXT: br label [[TMP9]]
235 ; NOPROFILE-NEXT: [[TMP10:%.*]] = phi i32 [ [[TMP8]], [[TMP7]] ], [ 0, [[TMP2:%.*]] ]
236 ; NOPROFILE-NEXT: ret i32 [[TMP10]]
238 ; NONE-LABEL: define dso_local noundef i32 @branchColdFnHot(
239 ; NONE-SAME: i32 noundef [[TMP0:%.*]], ptr noundef readonly [[TMP1:%.*]]) !prof [[PROF17]] {
240 ; NONE-NEXT: [[TMP3:%.*]] = icmp eq i32 [[TMP0]], 0
241 ; NONE-NEXT: br i1 [[TMP3]], label [[TMP9:%.*]], label [[TMP4:%.*]], !prof [[PROF18:![0-9]+]]
243 ; NONE-NEXT: [[TMP5:%.*]] = icmp eq ptr [[TMP1]], null
244 ; NONE-NEXT: [[HOT:%.*]] = xor i1 false, true
245 ; NONE-NEXT: [[TMP11:%.*]] = or i1 [[TMP5]], [[HOT]]
246 ; NONE-NEXT: br i1 [[TMP11]], label [[TMP6:%.*]], label [[TMP7:%.*]]
248 ; NONE-NEXT: tail call void @llvm.ubsantrap(i8 22)
249 ; NONE-NEXT: unreachable
251 ; NONE-NEXT: [[TMP8:%.*]] = load i32, ptr [[TMP1]], align 4
252 ; NONE-NEXT: br label [[TMP9]]
254 ; NONE-NEXT: [[TMP10:%.*]] = phi i32 [ [[TMP8]], [[TMP7]] ], [ 0, [[TMP2:%.*]] ]
255 ; NONE-NEXT: ret i32 [[TMP10]]
257 ; HOT99-LABEL: define dso_local noundef i32 @branchColdFnHot(
258 ; HOT99-SAME: i32 noundef [[TMP0:%.*]], ptr noundef readonly [[TMP1:%.*]]) !prof [[PROF17]] {
259 ; HOT99-NEXT: [[TMP3:%.*]] = icmp eq i32 [[TMP0]], 0
260 ; HOT99-NEXT: br i1 [[TMP3]], label [[TMP9:%.*]], label [[TMP4:%.*]], !prof [[PROF18:![0-9]+]]
262 ; HOT99-NEXT: [[TMP5:%.*]] = icmp eq ptr [[TMP1]], null
263 ; HOT99-NEXT: [[HOT:%.*]] = xor i1 true, true
264 ; HOT99-NEXT: [[TMP11:%.*]] = or i1 [[TMP5]], [[HOT]]
265 ; HOT99-NEXT: br i1 [[TMP11]], label [[TMP6:%.*]], label [[TMP7:%.*]]
267 ; HOT99-NEXT: tail call void @llvm.ubsantrap(i8 22)
268 ; HOT99-NEXT: unreachable
270 ; HOT99-NEXT: [[TMP8:%.*]] = load i32, ptr [[TMP1]], align 4
271 ; HOT99-NEXT: br label [[TMP9]]
273 ; HOT99-NEXT: [[TMP10:%.*]] = phi i32 [ [[TMP8]], [[TMP7]] ], [ 0, [[TMP2:%.*]] ]
274 ; HOT99-NEXT: ret i32 [[TMP10]]
276 ; HOT70-LABEL: define dso_local noundef i32 @branchColdFnHot(
277 ; HOT70-SAME: i32 noundef [[TMP0:%.*]], ptr noundef readonly [[TMP1:%.*]]) !prof [[PROF17]] {
278 ; HOT70-NEXT: [[TMP3:%.*]] = icmp eq i32 [[TMP0]], 0
279 ; HOT70-NEXT: br i1 [[TMP3]], label [[TMP9:%.*]], label [[TMP4:%.*]], !prof [[PROF18:![0-9]+]]
281 ; HOT70-NEXT: [[TMP5:%.*]] = icmp eq ptr [[TMP1]], null
282 ; HOT70-NEXT: [[HOT:%.*]] = xor i1 true, true
283 ; HOT70-NEXT: [[TMP11:%.*]] = or i1 [[TMP5]], [[HOT]]
284 ; HOT70-NEXT: br i1 [[TMP11]], label [[TMP6:%.*]], label [[TMP7:%.*]]
286 ; HOT70-NEXT: tail call void @llvm.ubsantrap(i8 22)
287 ; HOT70-NEXT: unreachable
289 ; HOT70-NEXT: [[TMP8:%.*]] = load i32, ptr [[TMP1]], align 4
290 ; HOT70-NEXT: br label [[TMP9]]
292 ; HOT70-NEXT: [[TMP10:%.*]] = phi i32 [ [[TMP8]], [[TMP7]] ], [ 0, [[TMP2:%.*]] ]
293 ; HOT70-NEXT: ret i32 [[TMP10]]
295 %3 = icmp eq i32 %0, 0
296 br i1 %3, label %9, label %4, !prof !38
299 %chk = icmp eq ptr %1, null
300 %allow = call i1 @llvm.allow.ubsan.check(i8 22)
301 %hot = xor i1 %allow, true
302 %5 = or i1 %chk, %hot
303 br i1 %5, label %6, label %7
306 tail call void @llvm.ubsantrap(i8 22) #2
310 %8 = load i32, ptr %1, align 4
314 %10 = phi i32 [ %8, %7 ], [ 0, %2 ]
318 define dso_local noundef i32 @branchHotFnCold(i32 noundef %0, ptr noundef readonly %1) !prof !36 {
319 ; NOPROFILE-LABEL: define dso_local noundef i32 @branchHotFnCold(
320 ; NOPROFILE-SAME: i32 noundef [[TMP0:%.*]], ptr noundef readonly [[TMP1:%.*]]) !prof [[PROF16]] {
321 ; NOPROFILE-NEXT: [[TMP3:%.*]] = icmp eq i32 [[TMP0]], 0
322 ; NOPROFILE-NEXT: br i1 [[TMP3]], label [[TMP9:%.*]], label [[TMP4:%.*]], !prof [[PROF19:![0-9]+]]
324 ; NOPROFILE-NEXT: [[TMP5:%.*]] = icmp eq ptr [[TMP1]], null
325 ; NOPROFILE-NEXT: [[HOT:%.*]] = xor i1 true, true
326 ; NOPROFILE-NEXT: [[TMP11:%.*]] = or i1 [[TMP5]], [[HOT]]
327 ; NOPROFILE-NEXT: br i1 [[TMP11]], label [[TMP6:%.*]], label [[TMP7:%.*]]
329 ; NOPROFILE-NEXT: tail call void @llvm.ubsantrap(i8 22)
330 ; NOPROFILE-NEXT: unreachable
332 ; NOPROFILE-NEXT: [[TMP8:%.*]] = load i32, ptr [[TMP1]], align 4
333 ; NOPROFILE-NEXT: br label [[TMP9]]
335 ; NOPROFILE-NEXT: [[TMP10:%.*]] = phi i32 [ [[TMP8]], [[TMP7]] ], [ 0, [[TMP2:%.*]] ]
336 ; NOPROFILE-NEXT: ret i32 [[TMP10]]
338 ; NONE-LABEL: define dso_local noundef i32 @branchHotFnCold(
339 ; NONE-SAME: i32 noundef [[TMP0:%.*]], ptr noundef readonly [[TMP1:%.*]]) !prof [[PROF16]] {
340 ; NONE-NEXT: [[TMP3:%.*]] = icmp eq i32 [[TMP0]], 0
341 ; NONE-NEXT: br i1 [[TMP3]], label [[TMP9:%.*]], label [[TMP4:%.*]], !prof [[PROF19:![0-9]+]]
343 ; NONE-NEXT: [[TMP5:%.*]] = icmp eq ptr [[TMP1]], null
344 ; NONE-NEXT: [[HOT:%.*]] = xor i1 false, true
345 ; NONE-NEXT: [[TMP11:%.*]] = or i1 [[TMP5]], [[HOT]]
346 ; NONE-NEXT: br i1 [[TMP11]], label [[TMP6:%.*]], label [[TMP7:%.*]]
348 ; NONE-NEXT: tail call void @llvm.ubsantrap(i8 22)
349 ; NONE-NEXT: unreachable
351 ; NONE-NEXT: [[TMP8:%.*]] = load i32, ptr [[TMP1]], align 4
352 ; NONE-NEXT: br label [[TMP9]]
354 ; NONE-NEXT: [[TMP10:%.*]] = phi i32 [ [[TMP8]], [[TMP7]] ], [ 0, [[TMP2:%.*]] ]
355 ; NONE-NEXT: ret i32 [[TMP10]]
357 ; HOT99-LABEL: define dso_local noundef i32 @branchHotFnCold(
358 ; HOT99-SAME: i32 noundef [[TMP0:%.*]], ptr noundef readonly [[TMP1:%.*]]) !prof [[PROF16]] {
359 ; HOT99-NEXT: [[TMP3:%.*]] = icmp eq i32 [[TMP0]], 0
360 ; HOT99-NEXT: br i1 [[TMP3]], label [[TMP9:%.*]], label [[TMP4:%.*]], !prof [[PROF19:![0-9]+]]
362 ; HOT99-NEXT: [[TMP5:%.*]] = icmp eq ptr [[TMP1]], null
363 ; HOT99-NEXT: [[HOT:%.*]] = xor i1 false, true
364 ; HOT99-NEXT: [[TMP11:%.*]] = or i1 [[TMP5]], [[HOT]]
365 ; HOT99-NEXT: br i1 [[TMP11]], label [[TMP6:%.*]], label [[TMP7:%.*]]
367 ; HOT99-NEXT: tail call void @llvm.ubsantrap(i8 22)
368 ; HOT99-NEXT: unreachable
370 ; HOT99-NEXT: [[TMP8:%.*]] = load i32, ptr [[TMP1]], align 4
371 ; HOT99-NEXT: br label [[TMP9]]
373 ; HOT99-NEXT: [[TMP10:%.*]] = phi i32 [ [[TMP8]], [[TMP7]] ], [ 0, [[TMP2:%.*]] ]
374 ; HOT99-NEXT: ret i32 [[TMP10]]
376 ; HOT70-LABEL: define dso_local noundef i32 @branchHotFnCold(
377 ; HOT70-SAME: i32 noundef [[TMP0:%.*]], ptr noundef readonly [[TMP1:%.*]]) !prof [[PROF16]] {
378 ; HOT70-NEXT: [[TMP3:%.*]] = icmp eq i32 [[TMP0]], 0
379 ; HOT70-NEXT: br i1 [[TMP3]], label [[TMP9:%.*]], label [[TMP4:%.*]], !prof [[PROF19:![0-9]+]]
381 ; HOT70-NEXT: [[TMP5:%.*]] = icmp eq ptr [[TMP1]], null
382 ; HOT70-NEXT: [[HOT:%.*]] = xor i1 true, true
383 ; HOT70-NEXT: [[TMP11:%.*]] = or i1 [[TMP5]], [[HOT]]
384 ; HOT70-NEXT: br i1 [[TMP11]], label [[TMP6:%.*]], label [[TMP7:%.*]]
386 ; HOT70-NEXT: tail call void @llvm.ubsantrap(i8 22)
387 ; HOT70-NEXT: unreachable
389 ; HOT70-NEXT: [[TMP8:%.*]] = load i32, ptr [[TMP1]], align 4
390 ; HOT70-NEXT: br label [[TMP9]]
392 ; HOT70-NEXT: [[TMP10:%.*]] = phi i32 [ [[TMP8]], [[TMP7]] ], [ 0, [[TMP2:%.*]] ]
393 ; HOT70-NEXT: ret i32 [[TMP10]]
395 %3 = icmp eq i32 %0, 0
396 br i1 %3, label %9, label %4, !prof !37
399 %chk = icmp eq ptr %1, null
400 %allow = call i1 @llvm.allow.ubsan.check(i8 22)
401 %hot = xor i1 %allow, true
402 %5 = or i1 %chk, %hot
403 br i1 %5, label %6, label %7
406 tail call void @llvm.ubsantrap(i8 22) #2
410 %8 = load i32, ptr %1, align 4
414 %10 = phi i32 [ %8, %7 ], [ 0, %2 ]
418 !llvm.module.flags = !{!6}
419 !6 = !{i32 1, !"ProfileSummary", !7}
420 !7 = !{!8, !9, !10, !11, !12, !13, !14, !17}
421 !8 = !{!"ProfileFormat", !"InstrProf"}
422 !9 = !{!"TotalCount", i64 30000}
423 !10 = !{!"MaxCount", i64 10000}
424 !11 = !{!"MaxInternalCount", i64 10000}
425 !12 = !{!"MaxFunctionCount", i64 10000}
426 !13 = !{!"NumCounts", i64 3}
427 !14 = !{!"NumFunctions", i64 5}
428 !17 = !{!"DetailedSummary", !18}
429 !18 = !{!19, !29, !30, !32, !34}
430 !19 = !{i32 10000, i64 10000, i32 3}
431 !29 = !{i32 950000, i64 5000, i32 3}
432 !30 = !{i32 990000, i64 500, i32 4}
433 !32 = !{i32 999900, i64 250, i32 4}
434 !34 = !{i32 999999, i64 1, i32 6}
436 !36 = !{!"function_entry_count", i64 1000}
437 !39 = !{!"function_entry_count", i64 7000}
439 !37 = !{!"branch_weights", i32 1, i32 1000}
440 !38 = !{!"branch_weights", i32 1000, i32 1}
443 ; NOPROFILE: [[PROF16]] = !{!"function_entry_count", i64 1000}
444 ; NOPROFILE: [[PROF17]] = !{!"function_entry_count", i64 7000}
445 ; NOPROFILE: [[PROF18]] = !{!"branch_weights", i32 1000, i32 1}
446 ; NOPROFILE: [[PROF19]] = !{!"branch_weights", i32 1, i32 1000}
448 ; NONE: [[PROF16]] = !{!"function_entry_count", i64 1000}
449 ; NONE: [[PROF17]] = !{!"function_entry_count", i64 7000}
450 ; NONE: [[PROF18]] = !{!"branch_weights", i32 1000, i32 1}
451 ; NONE: [[PROF19]] = !{!"branch_weights", i32 1, i32 1000}
453 ; HOT99: [[PROF16]] = !{!"function_entry_count", i64 1000}
454 ; HOT99: [[PROF17]] = !{!"function_entry_count", i64 7000}
455 ; HOT99: [[PROF18]] = !{!"branch_weights", i32 1000, i32 1}
456 ; HOT99: [[PROF19]] = !{!"branch_weights", i32 1, i32 1000}
458 ; HOT70: [[PROF16]] = !{!"function_entry_count", i64 1000}
459 ; HOT70: [[PROF17]] = !{!"function_entry_count", i64 7000}
460 ; HOT70: [[PROF18]] = !{!"branch_weights", i32 1000, i32 1}
461 ; HOT70: [[PROF19]] = !{!"branch_weights", i32 1, i32 1000}