[llvm] 3c59cde - Precommit updated InstCombine/and-xor-or.ll test. NFC.

Stanislav Mekhanoshin via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 20 12:51:16 PDT 2021


Author: Stanislav Mekhanoshin
Date: 2021-10-20T12:50:23-07:00
New Revision: 3c59cdee5caabdfc7735579cb43fbb5af18b6103

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

LOG: Precommit updated InstCombine/and-xor-or.ll test. NFC.

Added: 
    

Modified: 
    llvm/test/Transforms/InstCombine/and-xor-or.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstCombine/and-xor-or.ll b/llvm/test/Transforms/InstCombine/and-xor-or.ll
index e7a4c3ab3097..ec9f335a6c90 100644
--- a/llvm/test/Transforms/InstCombine/and-xor-or.ll
+++ b/llvm/test/Transforms/InstCombine/and-xor-or.ll
@@ -555,16 +555,14 @@ define <4 x i64> @not_and_and_not_4i64(<4 x i64> %a0, <4 x i64> %b, <4 x i64> %c
 
 ; (~b & a) & ~c --> a & ~(b | c)
 
-define i32 @not_and_and_not_commute1(i32 %a0, i32 %b, i32 %c) {
+define i32 @not_and_and_not_commute1(i32 %a, i32 %b, i32 %c) {
 ; CHECK-LABEL: @not_and_and_not_commute1(
-; CHECK-NEXT:    [[A:%.*]] = sdiv i32 42, [[A0:%.*]]
 ; CHECK-NEXT:    [[NOT1:%.*]] = xor i32 [[B:%.*]], -1
 ; CHECK-NEXT:    [[NOT2:%.*]] = xor i32 [[C:%.*]], -1
-; CHECK-NEXT:    [[AND1:%.*]] = and i32 [[A]], [[NOT1]]
+; CHECK-NEXT:    [[AND1:%.*]] = and i32 [[NOT1]], [[A:%.*]]
 ; CHECK-NEXT:    [[AND2:%.*]] = and i32 [[AND1]], [[NOT2]]
 ; CHECK-NEXT:    ret i32 [[AND2]]
 ;
-  %a = sdiv i32 42, %a0 ; thwart complexity-based canonicalization
   %not1 = xor i32 %b, -1
   %not2 = xor i32 %c, -1
   %and1 = and i32 %not1, %a
@@ -574,13 +572,15 @@ define i32 @not_and_and_not_commute1(i32 %a0, i32 %b, i32 %c) {
 
 ; ~c & (a & ~b) --> a & ~(b | c)
 
-define i32 @not_and_and_not_commute2(i32 %a0, i32 %b, i32 %c) {
-; CHECK-LABEL: @not_and_and_not_commute2(
+declare void @use(i32)
+define i32 @not_and_and_not_commute2_extra_not_use(i32 %a0, i32 %b, i32 %c) {
+; CHECK-LABEL: @not_and_and_not_commute2_extra_not_use(
 ; CHECK-NEXT:    [[A:%.*]] = sdiv i32 42, [[A0:%.*]]
 ; CHECK-NEXT:    [[NOT1:%.*]] = xor i32 [[B:%.*]], -1
 ; CHECK-NEXT:    [[NOT2:%.*]] = xor i32 [[C:%.*]], -1
 ; CHECK-NEXT:    [[AND1:%.*]] = and i32 [[A]], [[NOT1]]
 ; CHECK-NEXT:    [[AND2:%.*]] = and i32 [[AND1]], [[NOT2]]
+; CHECK-NEXT:    call void @use(i32 [[NOT2]])
 ; CHECK-NEXT:    ret i32 [[AND2]]
 ;
   %a = sdiv i32 42, %a0 ; thwart complexity-based canonicalization
@@ -588,5 +588,25 @@ define i32 @not_and_and_not_commute2(i32 %a0, i32 %b, i32 %c) {
   %not2 = xor i32 %c, -1
   %and1 = and i32 %a, %not1
   %and2 = and i32 %not2, %and1
+  call void @use(i32 %not2)
+  ret i32 %and2
+}
+
+define i32 @not_and_and_not_extra_and1_use(i32 %a0, i32 %b, i32 %c) {
+; CHECK-LABEL: @not_and_and_not_extra_and1_use(
+; CHECK-NEXT:    [[A:%.*]] = sdiv i32 42, [[A0:%.*]]
+; CHECK-NEXT:    [[NOT1:%.*]] = xor i32 [[B:%.*]], -1
+; CHECK-NEXT:    [[NOT2:%.*]] = xor i32 [[C:%.*]], -1
+; CHECK-NEXT:    [[AND1:%.*]] = and i32 [[A]], [[NOT1]]
+; CHECK-NEXT:    [[AND2:%.*]] = and i32 [[AND1]], [[NOT2]]
+; CHECK-NEXT:    call void @use(i32 [[AND1]])
+; CHECK-NEXT:    ret i32 [[AND2]]
+;
+  %a = sdiv i32 42, %a0 ; thwart complexity-based canonicalization
+  %not1 = xor i32 %b, -1
+  %not2 = xor i32 %c, -1
+  %and1 = and i32 %a, %not1
+  %and2 = and i32 %and1, %not2
+  call void @use(i32 %and1)
   ret i32 %and2
 }


        


More information about the llvm-commits mailing list