Skip to content

Commit

Permalink
[NFC][ubsan] Expand lower-builtin-allow-check test (llvm#100677)
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalybuka authored Jul 26, 2024
1 parent b5f2db2 commit d683d37
Showing 1 changed file with 83 additions and 0 deletions.
83 changes: 83 additions & 0 deletions llvm/test/Transforms/lower-builtin-allow-check.ll
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt < %s -passes='function(lower-allow-check)' -S | FileCheck %s --check-prefixes=NOPROFILE
; RUN: opt < %s -passes='function(lower-allow-check)' -lower-allow-check-random-rate=0 -S | FileCheck %s --check-prefixes=NONE
; RUN: opt < %s -passes='function(lower-allow-check)' -lower-allow-check-random-rate=1 -S | FileCheck %s --check-prefixes=ALL
; RUN: opt < %s -passes='require<profile-summary>,function(lower-allow-check)' -lower-allow-check-percentile-cutoff-hot=990000 -S | FileCheck %s --check-prefixes=HOT99
; RUN: opt < %s -passes='require<profile-summary>,function(lower-allow-check)' -lower-allow-check-percentile-cutoff-hot=700000 -S | FileCheck %s --check-prefixes=HOT70
; 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
Expand Down Expand Up @@ -38,6 +39,19 @@ define dso_local noundef i32 @simple(ptr noundef readonly %0) {
; NONE-NEXT: [[TMP5:%.*]] = load i32, ptr [[TMP0]], align 4
; NONE-NEXT: ret i32 [[TMP5]]
;
; ALL-LABEL: define dso_local noundef i32 @simple(
; ALL-SAME: ptr noundef readonly [[TMP0:%.*]]) {
; ALL-NEXT: [[CHK:%.*]] = icmp eq ptr [[TMP0]], null
; ALL-NEXT: [[HOT:%.*]] = xor i1 true, true
; ALL-NEXT: [[TMP2:%.*]] = or i1 [[CHK]], [[HOT]]
; ALL-NEXT: br i1 [[TMP2]], label [[TMP3:%.*]], label [[TMP4:%.*]]
; ALL: 3:
; ALL-NEXT: tail call void @llvm.ubsantrap(i8 22)
; ALL-NEXT: unreachable
; ALL: 4:
; ALL-NEXT: [[TMP5:%.*]] = load i32, ptr [[TMP0]], align 4
; ALL-NEXT: ret i32 [[TMP5]]
;
; HOT99-LABEL: define dso_local noundef i32 @simple(
; HOT99-SAME: ptr noundef readonly [[TMP0:%.*]]) {
; HOT99-NEXT: [[TMP2:%.*]] = icmp eq ptr [[TMP0]], null
Expand Down Expand Up @@ -133,6 +147,19 @@ define dso_local noundef i32 @hot(ptr noundef readonly %0) !prof !36 {
; NONE-NEXT: [[TMP5:%.*]] = load i32, ptr [[TMP0]], align 4
; NONE-NEXT: ret i32 [[TMP5]]
;
; ALL-LABEL: define dso_local noundef i32 @hot(
; ALL-SAME: ptr noundef readonly [[TMP0:%.*]]) !prof [[PROF16:![0-9]+]] {
; ALL-NEXT: [[CHK:%.*]] = icmp eq ptr [[TMP0]], null
; ALL-NEXT: [[HOT:%.*]] = xor i1 true, true
; ALL-NEXT: [[TMP2:%.*]] = or i1 [[CHK]], [[HOT]]
; ALL-NEXT: br i1 [[TMP2]], label [[TMP3:%.*]], label [[TMP4:%.*]]
; ALL: 3:
; ALL-NEXT: tail call void @llvm.ubsantrap(i8 22)
; ALL-NEXT: unreachable
; ALL: 4:
; ALL-NEXT: [[TMP5:%.*]] = load i32, ptr [[TMP0]], align 4
; ALL-NEXT: ret i32 [[TMP5]]
;
; HOT99-LABEL: define dso_local noundef i32 @hot(
; HOT99-SAME: ptr noundef readonly [[TMP0:%.*]]) !prof [[PROF16:![0-9]+]] {
; HOT99-NEXT: [[TMP2:%.*]] = icmp eq ptr [[TMP0]], null
Expand Down Expand Up @@ -227,6 +254,19 @@ define dso_local noundef i32 @veryHot(ptr noundef readonly %0) !prof !39 {
; NONE-NEXT: [[TMP5:%.*]] = load i32, ptr [[TMP0]], align 4
; NONE-NEXT: ret i32 [[TMP5]]
;
; ALL-LABEL: define dso_local noundef i32 @veryHot(
; ALL-SAME: ptr noundef readonly [[TMP0:%.*]]) !prof [[PROF17:![0-9]+]] {
; ALL-NEXT: [[CHK:%.*]] = icmp eq ptr [[TMP0]], null
; ALL-NEXT: [[HOT:%.*]] = xor i1 true, true
; ALL-NEXT: [[TMP2:%.*]] = or i1 [[CHK]], [[HOT]]
; ALL-NEXT: br i1 [[TMP2]], label [[TMP3:%.*]], label [[TMP4:%.*]]
; ALL: 3:
; ALL-NEXT: tail call void @llvm.ubsantrap(i8 22)
; ALL-NEXT: unreachable
; ALL: 4:
; ALL-NEXT: [[TMP5:%.*]] = load i32, ptr [[TMP0]], align 4
; ALL-NEXT: ret i32 [[TMP5]]
;
; HOT99-LABEL: define dso_local noundef i32 @veryHot(
; HOT99-SAME: ptr noundef readonly [[TMP0:%.*]]) !prof [[PROF17:![0-9]+]] {
; HOT99-NEXT: [[TMP2:%.*]] = icmp eq ptr [[TMP0]], null
Expand Down Expand Up @@ -334,6 +374,25 @@ define dso_local noundef i32 @branchColdFnHot(i32 noundef %0, ptr noundef readon
; NONE-NEXT: [[TMP10:%.*]] = phi i32 [ [[TMP8]], [[TMP7]] ], [ 0, [[TMP2:%.*]] ]
; NONE-NEXT: ret i32 [[TMP10]]
;
; ALL-LABEL: define dso_local noundef i32 @branchColdFnHot(
; ALL-SAME: i32 noundef [[TMP0:%.*]], ptr noundef readonly [[TMP1:%.*]]) !prof [[PROF17]] {
; ALL-NEXT: [[TMP3:%.*]] = icmp eq i32 [[TMP0]], 0
; ALL-NEXT: br i1 [[TMP3]], label [[TMP9:%.*]], label [[TMP4:%.*]], !prof [[PROF18:![0-9]+]]
; ALL: 4:
; ALL-NEXT: [[CHK:%.*]] = icmp eq ptr [[TMP1]], null
; ALL-NEXT: [[HOT:%.*]] = xor i1 true, true
; ALL-NEXT: [[TMP5:%.*]] = or i1 [[CHK]], [[HOT]]
; ALL-NEXT: br i1 [[TMP5]], label [[TMP6:%.*]], label [[TMP7:%.*]]
; ALL: 6:
; ALL-NEXT: tail call void @llvm.ubsantrap(i8 22)
; ALL-NEXT: unreachable
; ALL: 7:
; ALL-NEXT: [[TMP8:%.*]] = load i32, ptr [[TMP1]], align 4
; ALL-NEXT: br label [[TMP9]]
; ALL: 9:
; ALL-NEXT: [[TMP10:%.*]] = phi i32 [ [[TMP8]], [[TMP7]] ], [ 0, [[TMP2:%.*]] ]
; ALL-NEXT: ret i32 [[TMP10]]
;
; HOT99-LABEL: define dso_local noundef i32 @branchColdFnHot(
; HOT99-SAME: i32 noundef [[TMP0:%.*]], ptr noundef readonly [[TMP1:%.*]]) !prof [[PROF17]] {
; HOT99-NEXT: [[TMP3:%.*]] = icmp eq i32 [[TMP0]], 0
Expand Down Expand Up @@ -472,6 +531,25 @@ define dso_local noundef i32 @branchHotFnCold(i32 noundef %0, ptr noundef readon
; NONE-NEXT: [[TMP10:%.*]] = phi i32 [ [[TMP8]], [[TMP7]] ], [ 0, [[TMP2:%.*]] ]
; NONE-NEXT: ret i32 [[TMP10]]
;
; ALL-LABEL: define dso_local noundef i32 @branchHotFnCold(
; ALL-SAME: i32 noundef [[TMP0:%.*]], ptr noundef readonly [[TMP1:%.*]]) !prof [[PROF16]] {
; ALL-NEXT: [[TMP3:%.*]] = icmp eq i32 [[TMP0]], 0
; ALL-NEXT: br i1 [[TMP3]], label [[TMP9:%.*]], label [[TMP4:%.*]], !prof [[PROF19:![0-9]+]]
; ALL: 4:
; ALL-NEXT: [[CHK:%.*]] = icmp eq ptr [[TMP1]], null
; ALL-NEXT: [[HOT:%.*]] = xor i1 true, true
; ALL-NEXT: [[TMP5:%.*]] = or i1 [[CHK]], [[HOT]]
; ALL-NEXT: br i1 [[TMP5]], label [[TMP6:%.*]], label [[TMP7:%.*]]
; ALL: 6:
; ALL-NEXT: tail call void @llvm.ubsantrap(i8 22)
; ALL-NEXT: unreachable
; ALL: 7:
; ALL-NEXT: [[TMP8:%.*]] = load i32, ptr [[TMP1]], align 4
; ALL-NEXT: br label [[TMP9]]
; ALL: 9:
; ALL-NEXT: [[TMP10:%.*]] = phi i32 [ [[TMP8]], [[TMP7]] ], [ 0, [[TMP2:%.*]] ]
; ALL-NEXT: ret i32 [[TMP10]]
;
; HOT99-LABEL: define dso_local noundef i32 @branchHotFnCold(
; HOT99-SAME: i32 noundef [[TMP0:%.*]], ptr noundef readonly [[TMP1:%.*]]) !prof [[PROF16]] {
; HOT99-NEXT: [[TMP3:%.*]] = icmp eq i32 [[TMP0]], 0
Expand Down Expand Up @@ -606,6 +684,11 @@ define dso_local noundef i32 @branchHotFnCold(i32 noundef %0, ptr noundef readon
; NONE: [[PROF18]] = !{!"branch_weights", i32 1000, i32 1}
; NONE: [[PROF19]] = !{!"branch_weights", i32 1, i32 1000}
;.
; ALL: [[PROF16]] = !{!"function_entry_count", i64 1000}
; ALL: [[PROF17]] = !{!"function_entry_count", i64 7000}
; ALL: [[PROF18]] = !{!"branch_weights", i32 1000, i32 1}
; ALL: [[PROF19]] = !{!"branch_weights", i32 1, i32 1000}
;.
; HOT99: [[PROF16]] = !{!"function_entry_count", i64 1000}
; HOT99: [[PROF17]] = !{!"function_entry_count", i64 7000}
; HOT99: [[PROF18]] = !{!"branch_weights", i32 1000, i32 1}
Expand Down

0 comments on commit d683d37

Please sign in to comment.