Skip to content

Commit d683d37

Browse files
authored
[NFC][ubsan] Expand lower-builtin-allow-check test (#100677)
1 parent b5f2db2 commit d683d37

File tree

1 file changed

+83
-0
lines changed

1 file changed

+83
-0
lines changed

llvm/test/Transforms/lower-builtin-allow-check.ll

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
22
; RUN: opt < %s -passes='function(lower-allow-check)' -S | FileCheck %s --check-prefixes=NOPROFILE
33
; 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='function(lower-allow-check)' -lower-allow-check-random-rate=1 -S | FileCheck %s --check-prefixes=ALL
45
; RUN: opt < %s -passes='require<profile-summary>,function(lower-allow-check)' -lower-allow-check-percentile-cutoff-hot=990000 -S | FileCheck %s --check-prefixes=HOT99
56
; RUN: opt < %s -passes='require<profile-summary>,function(lower-allow-check)' -lower-allow-check-percentile-cutoff-hot=700000 -S | FileCheck %s --check-prefixes=HOT70
67
; RUN: opt < %s -passes='require<profile-summary>,function(lower-allow-check)' -lower-allow-check-random-rate=0 -lower-allow-check-percentile-cutoff-hot=990000 -S | FileCheck %s --check-prefixes=NONE99
@@ -38,6 +39,19 @@ define dso_local noundef i32 @simple(ptr noundef readonly %0) {
3839
; NONE-NEXT: [[TMP5:%.*]] = load i32, ptr [[TMP0]], align 4
3940
; NONE-NEXT: ret i32 [[TMP5]]
4041
;
42+
; ALL-LABEL: define dso_local noundef i32 @simple(
43+
; ALL-SAME: ptr noundef readonly [[TMP0:%.*]]) {
44+
; ALL-NEXT: [[CHK:%.*]] = icmp eq ptr [[TMP0]], null
45+
; ALL-NEXT: [[HOT:%.*]] = xor i1 true, true
46+
; ALL-NEXT: [[TMP2:%.*]] = or i1 [[CHK]], [[HOT]]
47+
; ALL-NEXT: br i1 [[TMP2]], label [[TMP3:%.*]], label [[TMP4:%.*]]
48+
; ALL: 3:
49+
; ALL-NEXT: tail call void @llvm.ubsantrap(i8 22)
50+
; ALL-NEXT: unreachable
51+
; ALL: 4:
52+
; ALL-NEXT: [[TMP5:%.*]] = load i32, ptr [[TMP0]], align 4
53+
; ALL-NEXT: ret i32 [[TMP5]]
54+
;
4155
; HOT99-LABEL: define dso_local noundef i32 @simple(
4256
; HOT99-SAME: ptr noundef readonly [[TMP0:%.*]]) {
4357
; HOT99-NEXT: [[TMP2:%.*]] = icmp eq ptr [[TMP0]], null
@@ -133,6 +147,19 @@ define dso_local noundef i32 @hot(ptr noundef readonly %0) !prof !36 {
133147
; NONE-NEXT: [[TMP5:%.*]] = load i32, ptr [[TMP0]], align 4
134148
; NONE-NEXT: ret i32 [[TMP5]]
135149
;
150+
; ALL-LABEL: define dso_local noundef i32 @hot(
151+
; ALL-SAME: ptr noundef readonly [[TMP0:%.*]]) !prof [[PROF16:![0-9]+]] {
152+
; ALL-NEXT: [[CHK:%.*]] = icmp eq ptr [[TMP0]], null
153+
; ALL-NEXT: [[HOT:%.*]] = xor i1 true, true
154+
; ALL-NEXT: [[TMP2:%.*]] = or i1 [[CHK]], [[HOT]]
155+
; ALL-NEXT: br i1 [[TMP2]], label [[TMP3:%.*]], label [[TMP4:%.*]]
156+
; ALL: 3:
157+
; ALL-NEXT: tail call void @llvm.ubsantrap(i8 22)
158+
; ALL-NEXT: unreachable
159+
; ALL: 4:
160+
; ALL-NEXT: [[TMP5:%.*]] = load i32, ptr [[TMP0]], align 4
161+
; ALL-NEXT: ret i32 [[TMP5]]
162+
;
136163
; HOT99-LABEL: define dso_local noundef i32 @hot(
137164
; HOT99-SAME: ptr noundef readonly [[TMP0:%.*]]) !prof [[PROF16:![0-9]+]] {
138165
; HOT99-NEXT: [[TMP2:%.*]] = icmp eq ptr [[TMP0]], null
@@ -227,6 +254,19 @@ define dso_local noundef i32 @veryHot(ptr noundef readonly %0) !prof !39 {
227254
; NONE-NEXT: [[TMP5:%.*]] = load i32, ptr [[TMP0]], align 4
228255
; NONE-NEXT: ret i32 [[TMP5]]
229256
;
257+
; ALL-LABEL: define dso_local noundef i32 @veryHot(
258+
; ALL-SAME: ptr noundef readonly [[TMP0:%.*]]) !prof [[PROF17:![0-9]+]] {
259+
; ALL-NEXT: [[CHK:%.*]] = icmp eq ptr [[TMP0]], null
260+
; ALL-NEXT: [[HOT:%.*]] = xor i1 true, true
261+
; ALL-NEXT: [[TMP2:%.*]] = or i1 [[CHK]], [[HOT]]
262+
; ALL-NEXT: br i1 [[TMP2]], label [[TMP3:%.*]], label [[TMP4:%.*]]
263+
; ALL: 3:
264+
; ALL-NEXT: tail call void @llvm.ubsantrap(i8 22)
265+
; ALL-NEXT: unreachable
266+
; ALL: 4:
267+
; ALL-NEXT: [[TMP5:%.*]] = load i32, ptr [[TMP0]], align 4
268+
; ALL-NEXT: ret i32 [[TMP5]]
269+
;
230270
; HOT99-LABEL: define dso_local noundef i32 @veryHot(
231271
; HOT99-SAME: ptr noundef readonly [[TMP0:%.*]]) !prof [[PROF17:![0-9]+]] {
232272
; HOT99-NEXT: [[TMP2:%.*]] = icmp eq ptr [[TMP0]], null
@@ -334,6 +374,25 @@ define dso_local noundef i32 @branchColdFnHot(i32 noundef %0, ptr noundef readon
334374
; NONE-NEXT: [[TMP10:%.*]] = phi i32 [ [[TMP8]], [[TMP7]] ], [ 0, [[TMP2:%.*]] ]
335375
; NONE-NEXT: ret i32 [[TMP10]]
336376
;
377+
; ALL-LABEL: define dso_local noundef i32 @branchColdFnHot(
378+
; ALL-SAME: i32 noundef [[TMP0:%.*]], ptr noundef readonly [[TMP1:%.*]]) !prof [[PROF17]] {
379+
; ALL-NEXT: [[TMP3:%.*]] = icmp eq i32 [[TMP0]], 0
380+
; ALL-NEXT: br i1 [[TMP3]], label [[TMP9:%.*]], label [[TMP4:%.*]], !prof [[PROF18:![0-9]+]]
381+
; ALL: 4:
382+
; ALL-NEXT: [[CHK:%.*]] = icmp eq ptr [[TMP1]], null
383+
; ALL-NEXT: [[HOT:%.*]] = xor i1 true, true
384+
; ALL-NEXT: [[TMP5:%.*]] = or i1 [[CHK]], [[HOT]]
385+
; ALL-NEXT: br i1 [[TMP5]], label [[TMP6:%.*]], label [[TMP7:%.*]]
386+
; ALL: 6:
387+
; ALL-NEXT: tail call void @llvm.ubsantrap(i8 22)
388+
; ALL-NEXT: unreachable
389+
; ALL: 7:
390+
; ALL-NEXT: [[TMP8:%.*]] = load i32, ptr [[TMP1]], align 4
391+
; ALL-NEXT: br label [[TMP9]]
392+
; ALL: 9:
393+
; ALL-NEXT: [[TMP10:%.*]] = phi i32 [ [[TMP8]], [[TMP7]] ], [ 0, [[TMP2:%.*]] ]
394+
; ALL-NEXT: ret i32 [[TMP10]]
395+
;
337396
; HOT99-LABEL: define dso_local noundef i32 @branchColdFnHot(
338397
; HOT99-SAME: i32 noundef [[TMP0:%.*]], ptr noundef readonly [[TMP1:%.*]]) !prof [[PROF17]] {
339398
; HOT99-NEXT: [[TMP3:%.*]] = icmp eq i32 [[TMP0]], 0
@@ -472,6 +531,25 @@ define dso_local noundef i32 @branchHotFnCold(i32 noundef %0, ptr noundef readon
472531
; NONE-NEXT: [[TMP10:%.*]] = phi i32 [ [[TMP8]], [[TMP7]] ], [ 0, [[TMP2:%.*]] ]
473532
; NONE-NEXT: ret i32 [[TMP10]]
474533
;
534+
; ALL-LABEL: define dso_local noundef i32 @branchHotFnCold(
535+
; ALL-SAME: i32 noundef [[TMP0:%.*]], ptr noundef readonly [[TMP1:%.*]]) !prof [[PROF16]] {
536+
; ALL-NEXT: [[TMP3:%.*]] = icmp eq i32 [[TMP0]], 0
537+
; ALL-NEXT: br i1 [[TMP3]], label [[TMP9:%.*]], label [[TMP4:%.*]], !prof [[PROF19:![0-9]+]]
538+
; ALL: 4:
539+
; ALL-NEXT: [[CHK:%.*]] = icmp eq ptr [[TMP1]], null
540+
; ALL-NEXT: [[HOT:%.*]] = xor i1 true, true
541+
; ALL-NEXT: [[TMP5:%.*]] = or i1 [[CHK]], [[HOT]]
542+
; ALL-NEXT: br i1 [[TMP5]], label [[TMP6:%.*]], label [[TMP7:%.*]]
543+
; ALL: 6:
544+
; ALL-NEXT: tail call void @llvm.ubsantrap(i8 22)
545+
; ALL-NEXT: unreachable
546+
; ALL: 7:
547+
; ALL-NEXT: [[TMP8:%.*]] = load i32, ptr [[TMP1]], align 4
548+
; ALL-NEXT: br label [[TMP9]]
549+
; ALL: 9:
550+
; ALL-NEXT: [[TMP10:%.*]] = phi i32 [ [[TMP8]], [[TMP7]] ], [ 0, [[TMP2:%.*]] ]
551+
; ALL-NEXT: ret i32 [[TMP10]]
552+
;
475553
; HOT99-LABEL: define dso_local noundef i32 @branchHotFnCold(
476554
; HOT99-SAME: i32 noundef [[TMP0:%.*]], ptr noundef readonly [[TMP1:%.*]]) !prof [[PROF16]] {
477555
; HOT99-NEXT: [[TMP3:%.*]] = icmp eq i32 [[TMP0]], 0
@@ -606,6 +684,11 @@ define dso_local noundef i32 @branchHotFnCold(i32 noundef %0, ptr noundef readon
606684
; NONE: [[PROF18]] = !{!"branch_weights", i32 1000, i32 1}
607685
; NONE: [[PROF19]] = !{!"branch_weights", i32 1, i32 1000}
608686
;.
687+
; ALL: [[PROF16]] = !{!"function_entry_count", i64 1000}
688+
; ALL: [[PROF17]] = !{!"function_entry_count", i64 7000}
689+
; ALL: [[PROF18]] = !{!"branch_weights", i32 1000, i32 1}
690+
; ALL: [[PROF19]] = !{!"branch_weights", i32 1, i32 1000}
691+
;.
609692
; HOT99: [[PROF16]] = !{!"function_entry_count", i64 1000}
610693
; HOT99: [[PROF17]] = !{!"function_entry_count", i64 7000}
611694
; HOT99: [[PROF18]] = !{!"branch_weights", i32 1000, i32 1}

0 commit comments

Comments
 (0)