[llvm] db1fbd6 - [BDCE] Add tests for #80113 (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 31 02:10:51 PST 2024


Author: Nikita Popov
Date: 2024-01-31T11:10:43+01:00
New Revision: db1fbd65eb5cec0eb8ac0bd0cc38c88dda1babf7

URL: https://github.com/llvm/llvm-project/commit/db1fbd65eb5cec0eb8ac0bd0cc38c88dda1babf7
DIFF: https://github.com/llvm/llvm-project/commit/db1fbd65eb5cec0eb8ac0bd0cc38c88dda1babf7.diff

LOG: [BDCE] Add tests for #80113 (NFC)

Added: 
    

Modified: 
    llvm/test/Transforms/BDCE/invalidate-assumptions.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/BDCE/invalidate-assumptions.ll b/llvm/test/Transforms/BDCE/invalidate-assumptions.ll
index 9cc85e33d8d4a..95a004b5e9d33 100644
--- a/llvm/test/Transforms/BDCE/invalidate-assumptions.ll
+++ b/llvm/test/Transforms/BDCE/invalidate-assumptions.ll
@@ -1,4 +1,4 @@
-; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
 ; RUN: opt -passes=bdce %s -S | FileCheck %s
 
 ; The 'nuw' on the subtract allows us to deduce that %setbit is not demanded.
@@ -8,8 +8,9 @@
 ; https://bugs.llvm.org/show_bug.cgi?id=33695
 
 define i1 @PR33695(i1 %b, i8 %x) {
-; CHECK-LABEL: @PR33695(
-; CHECK-NEXT:    [[LITTLE_NUMBER:%.*]] = zext i1 [[B:%.*]] to i8
+; CHECK-LABEL: define i1 @PR33695(
+; CHECK-SAME: i1 [[B:%.*]], i8 [[X:%.*]]) {
+; CHECK-NEXT:    [[LITTLE_NUMBER:%.*]] = zext i1 [[B]] to i8
 ; CHECK-NEXT:    [[BIG_NUMBER:%.*]] = shl i8 0, 1
 ; CHECK-NEXT:    [[SUB:%.*]] = sub i8 [[BIG_NUMBER]], [[LITTLE_NUMBER]]
 ; CHECK-NEXT:    [[TRUNC:%.*]] = trunc i8 [[SUB]] to i1
@@ -27,13 +28,14 @@ define i1 @PR33695(i1 %b, i8 %x) {
 ; https://bugs.llvm.org/show_bug.cgi?id=34037
 
 define i64 @PR34037(i64 %m, i32 %r, i64 %j, i1 %b, i32 %k, i64 %p) {
-; CHECK-LABEL: @PR34037(
+; CHECK-LABEL: define i64 @PR34037(
+; CHECK-SAME: i64 [[M:%.*]], i32 [[R:%.*]], i64 [[J:%.*]], i1 [[B:%.*]], i32 [[K:%.*]], i64 [[P:%.*]]) {
 ; CHECK-NEXT:    [[SHL:%.*]] = shl i64 0, 29
-; CHECK-NEXT:    [[CONV1:%.*]] = select i1 [[B:%.*]], i64 7, i64 0
+; CHECK-NEXT:    [[CONV1:%.*]] = select i1 [[B]], i64 7, i64 0
 ; CHECK-NEXT:    [[SUB:%.*]] = sub i64 [[SHL]], [[CONV1]]
-; CHECK-NEXT:    [[CONV2:%.*]] = zext i32 [[K:%.*]] to i64
+; CHECK-NEXT:    [[CONV2:%.*]] = zext i32 [[K]] to i64
 ; CHECK-NEXT:    [[MUL:%.*]] = mul i64 [[SUB]], [[CONV2]]
-; CHECK-NEXT:    [[CONV4:%.*]] = and i64 [[P:%.*]], 65535
+; CHECK-NEXT:    [[CONV4:%.*]] = and i64 [[P]], 65535
 ; CHECK-NEXT:    [[AND5:%.*]] = and i64 [[MUL]], [[CONV4]]
 ; CHECK-NEXT:    ret i64 [[AND5]]
 ;
@@ -58,8 +60,9 @@ define i64 @PR34037(i64 %m, i32 %r, i64 %j, i1 %b, i32 %k, i64 %p) {
 declare i1 @foo(i1)
 
 define i1 @poison_on_call_user_is_ok(i1 %b, i8 %x) {
-; CHECK-LABEL: @poison_on_call_user_is_ok(
-; CHECK-NEXT:    [[LITTLE_NUMBER:%.*]] = zext i1 [[B:%.*]] to i8
+; CHECK-LABEL: define i1 @poison_on_call_user_is_ok(
+; CHECK-SAME: i1 [[B:%.*]], i8 [[X:%.*]]) {
+; CHECK-NEXT:    [[LITTLE_NUMBER:%.*]] = zext i1 [[B]] to i8
 ; CHECK-NEXT:    [[BIG_NUMBER:%.*]] = shl i8 0, 1
 ; CHECK-NEXT:    [[SUB:%.*]] = sub i8 [[BIG_NUMBER]], [[LITTLE_NUMBER]]
 ; CHECK-NEXT:    [[TRUNC:%.*]] = trunc i8 [[SUB]] to i1
@@ -84,8 +87,9 @@ define i1 @poison_on_call_user_is_ok(i1 %b, i8 %x) {
 ; also integer-typed, but that's too strong. The alloca has a pointer-type result.
 
 define void @PR34179(ptr %a) {
-; CHECK-LABEL: @PR34179(
-; CHECK-NEXT:    [[T0:%.*]] = load volatile i32, ptr [[A:%.*]]
+; CHECK-LABEL: define void @PR34179(
+; CHECK-SAME: ptr [[A:%.*]]) {
+; CHECK-NEXT:    [[T0:%.*]] = load volatile i32, ptr [[A]], align 4
 ; CHECK-NEXT:    ret void
 ;
   %t0 = load volatile i32, ptr %a
@@ -93,3 +97,42 @@ define void @PR34179(ptr %a) {
   ret void
 }
 
+define i64 @disjoint(i64 %x) {
+; CHECK-LABEL: define i64 @disjoint(
+; CHECK-SAME: i64 [[X:%.*]]) {
+; CHECK-NEXT:    [[OR:%.*]] = or disjoint i64 [[X]], -2
+; CHECK-NEXT:    ret i64 [[OR]]
+;
+  %and = and i64 %x, 1
+  %or = or disjoint i64 %and, -2
+  ret i64 %or
+}
+
+define i32 @disjoint_indirect(i64 %x) {
+; CHECK-LABEL: define i32 @disjoint_indirect(
+; CHECK-SAME: i64 [[X:%.*]]) {
+; CHECK-NEXT:    [[TRUNC:%.*]] = trunc i64 [[X]] to i32
+; CHECK-NEXT:    [[OR:%.*]] = or disjoint i32 [[TRUNC]], -2
+; CHECK-NEXT:    ret i32 [[OR]]
+;
+  %and = and i64 %x, 1
+  %trunc = trunc i64 %and to i32
+  %or = or disjoint i32 %trunc, -2
+  ret i32 %or
+}
+
+define i32 @range(i32 %x) {
+; CHECK-LABEL: define i32 @range(
+; CHECK-SAME: i32 [[X:%.*]]) {
+; CHECK-NEXT:    [[UMIN:%.*]] = call i32 @llvm.umin.i32(i32 [[X]], i32 100), !range [[RNG0:![0-9]+]]
+; CHECK-NEXT:    [[AND:%.*]] = and i32 [[UMIN]], -2
+; CHECK-NEXT:    ret i32 [[AND]]
+;
+  %or = or i32 %x, 1
+  %umin = call i32 @llvm.umin.i32(i32 %or, i32 100), !range !{i32 1, i32 101}
+  %and = and i32 %umin, -2
+  ret i32 %and
+}
+;.
+; CHECK: [[RNG0]] = !{i32 1, i32 101}
+;.


        


More information about the llvm-commits mailing list