[llvm] c8f40e7 - [InstCombine] Add more test variants with poison elements (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 22 07:14:32 PDT 2024


Author: Nikita Popov
Date: 2024-08-22T16:14:23+02:00
New Revision: c8f40e7cf546557e885fe06b0349753d78193872

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

LOG: [InstCombine] Add more test variants with poison elements (NFC)

Added: 
    

Modified: 
    llvm/test/Transforms/InstCombine/bit-checks.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstCombine/bit-checks.ll b/llvm/test/Transforms/InstCombine/bit-checks.ll
index b1ab9d888954bb..93cf09f530192f 100644
--- a/llvm/test/Transforms/InstCombine/bit-checks.ll
+++ b/llvm/test/Transforms/InstCombine/bit-checks.ll
@@ -1339,6 +1339,56 @@ define i1 @no_masks_with_logical_or(i32 %a, i32 %b, i32 noundef %c) {
   ret i1 %or2
 }
 
+define i1 @no_masks_with_logical_or2(i32 %a, i32 %b, i32 noundef %c) {
+; CHECK-LABEL: @no_masks_with_logical_or2(
+; CHECK-NEXT:    [[CMP2:%.*]] = icmp ne i32 [[B:%.*]], 63
+; CHECK-NEXT:    [[TMP1:%.*]] = and i32 [[A:%.*]], [[C:%.*]]
+; CHECK-NEXT:    [[TMP2:%.*]] = icmp ne i32 [[TMP1]], -1
+; CHECK-NEXT:    [[OR2:%.*]] = select i1 [[TMP2]], i1 true, i1 [[CMP2]]
+; CHECK-NEXT:    ret i1 [[OR2]]
+;
+  %cmp1 = icmp ne i32 %a, -1
+  %cmp2 = icmp ne i32 %b, 63
+  %or1 = select i1 %cmp1, i1 true, i1 %cmp2
+  %cmp3 = icmp ne i32 %c, -1
+  %or2 = or i1 %or1, %cmp3
+  ret i1 %or2
+}
+
+define <2 x i1> @no_masks_with_logical_or_vec_poison1(<2 x i32> %a, <2 x i32> %b, <2 x i32> noundef %c) {
+; CHECK-LABEL: @no_masks_with_logical_or_vec_poison1(
+; CHECK-NEXT:    [[CMP1:%.*]] = icmp ne <2 x i32> [[A:%.*]], <i32 0, i32 poison>
+; CHECK-NEXT:    [[CMP2:%.*]] = icmp ne <2 x i32> [[B:%.*]], <i32 63, i32 poison>
+; CHECK-NEXT:    [[OR1:%.*]] = select <2 x i1> [[CMP1]], <2 x i1> <i1 true, i1 true>, <2 x i1> [[CMP2]]
+; CHECK-NEXT:    [[CMP3:%.*]] = icmp ne <2 x i32> [[C:%.*]], <i32 0, i32 poison>
+; CHECK-NEXT:    [[OR2:%.*]] = or <2 x i1> [[OR1]], [[CMP3]]
+; CHECK-NEXT:    ret <2 x i1> [[OR2]]
+;
+  %cmp1 = icmp ne <2 x i32> %a, <i32 0, i32 poison>
+  %cmp2 = icmp ne <2 x i32> %b, <i32 63, i32 poison>
+  %or1 = select <2 x i1> %cmp1, <2 x i1> <i1 true, i1 true>, <2 x i1> %cmp2
+  %cmp3 = icmp ne <2 x i32> %c, <i32 0, i32 poison>
+  %or2 = or <2 x i1> %or1, %cmp3
+  ret <2 x i1> %or2
+}
+
+define <2 x i1> @no_masks_with_logical_or_vec_poison2(<2 x i32> %a, <2 x i32> %b, <2 x i32> noundef %c) {
+; CHECK-LABEL: @no_masks_with_logical_or_vec_poison2(
+; CHECK-NEXT:    [[CMP1:%.*]] = icmp ne <2 x i32> [[A:%.*]], <i32 -1, i32 poison>
+; CHECK-NEXT:    [[CMP2:%.*]] = icmp ne <2 x i32> [[B:%.*]], <i32 63, i32 poison>
+; CHECK-NEXT:    [[OR1:%.*]] = select <2 x i1> [[CMP1]], <2 x i1> <i1 true, i1 true>, <2 x i1> [[CMP2]]
+; CHECK-NEXT:    [[CMP3:%.*]] = icmp ne <2 x i32> [[C:%.*]], <i32 -1, i32 poison>
+; CHECK-NEXT:    [[OR2:%.*]] = or <2 x i1> [[OR1]], [[CMP3]]
+; CHECK-NEXT:    ret <2 x i1> [[OR2]]
+;
+  %cmp1 = icmp ne <2 x i32> %a, <i32 -1, i32 poison>
+  %cmp2 = icmp ne <2 x i32> %b, <i32 63, i32 poison>
+  %or1 = select <2 x i1> %cmp1, <2 x i1> <i1 true, i1 true>, <2 x i1> %cmp2
+  %cmp3 = icmp ne <2 x i32> %c, <i32 -1, i32 poison>
+  %or2 = or <2 x i1> %or1, %cmp3
+  ret <2 x i1> %or2
+}
+
 define i1 @only_one_masked(i64 %a) {
 ; CHECK-LABEL: @only_one_masked(
 ; CHECK-NEXT:    [[AND:%.*]] = icmp eq i64 [[A:%.*]], -9223372036854775808


        


More information about the llvm-commits mailing list