[llvm] d683d37 - [NFC][ubsan] Expand lower-builtin-allow-check test (#100677)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 26 10:17:39 PDT 2024
Author: Vitaly Buka
Date: 2024-07-26T10:17:36-07:00
New Revision: d683d378998c85c12d7f0549944f807bb44c7b76
URL: https://github.com/llvm/llvm-project/commit/d683d378998c85c12d7f0549944f807bb44c7b76
DIFF: https://github.com/llvm/llvm-project/commit/d683d378998c85c12d7f0549944f807bb44c7b76.diff
LOG: [NFC][ubsan] Expand lower-builtin-allow-check test (#100677)
Added:
Modified:
llvm/test/Transforms/lower-builtin-allow-check.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/lower-builtin-allow-check.ll b/llvm/test/Transforms/lower-builtin-allow-check.ll
index 0157214ab47fe..2f6fa96ffd9c5 100644
--- a/llvm/test/Transforms/lower-builtin-allow-check.ll
+++ b/llvm/test/Transforms/lower-builtin-allow-check.ll
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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}
More information about the llvm-commits
mailing list