[llvm] [NFC][ubsan] Expand lower-builtin-allow-check test (PR #100677)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 25 18:00:35 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-transforms
Author: Vitaly Buka (vitalybuka)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/100677.diff
1 Files Affected:
- (modified) llvm/test/Transforms/lower-builtin-allow-check.ll (+83)
``````````diff
diff --git a/llvm/test/Transforms/lower-builtin-allow-check.ll b/llvm/test/Transforms/lower-builtin-allow-check.ll
index 05d940a46716c..d992f420ac170 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
@@ -36,6 +37,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
@@ -105,6 +119,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
@@ -173,6 +200,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
@@ -254,6 +294,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
@@ -354,6 +413,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
@@ -450,6 +528,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}
``````````
</details>
https://github.com/llvm/llvm-project/pull/100677
More information about the llvm-commits
mailing list