[llvm] 4f381af - [InstCombine] Add additional multi-use test for and/or replacement (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 7 07:51:22 PST 2024


Author: Nikita Popov
Date: 2024-02-07T16:51:13+01:00
New Revision: 4f381afa09c2e60f48a65b10074f8b862a0b6738

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

LOG: [InstCombine] Add additional multi-use test for and/or replacement (NFC)

Added: 
    

Modified: 
    llvm/test/Transforms/InstCombine/or.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstCombine/or.ll b/llvm/test/Transforms/InstCombine/or.ll
index 2238b6bcc56537..1fc48d0d822e6c 100644
--- a/llvm/test/Transforms/InstCombine/or.ll
+++ b/llvm/test/Transforms/InstCombine/or.ll
@@ -1901,3 +1901,20 @@ define i32 @test_or_add_xor(i32 %a, i32 %b, i32 %c) {
   %or = or i32 %add, %a
   ret i32 %or
 }
+
+define i32 @test_or_and_and_multiuse(i32 %a, i32 %b, i32 %c) {
+; CHECK-LABEL: @test_or_and_and_multiuse(
+; CHECK-NEXT:    [[AND1:%.*]] = and i32 [[A:%.*]], [[B:%.*]]
+; CHECK-NEXT:    [[AND2:%.*]] = and i32 [[AND1]], [[C:%.*]]
+; CHECK-NEXT:    call void @use(i32 [[AND1]])
+; CHECK-NEXT:    call void @use(i32 [[AND2]])
+; CHECK-NEXT:    [[OR:%.*]] = or i32 [[AND2]], [[A]]
+; CHECK-NEXT:    ret i32 [[OR]]
+;
+  %and1 = and i32 %a, %b
+  %and2 = and i32 %and1, %c
+  call void @use(i32 %and1)
+  call void @use(i32 %and2)
+  %or = or i32 %and2, %a
+  ret i32 %or
+}


        


More information about the llvm-commits mailing list