[Mlir-commits] [mlir] [MLIR][Arith] add and(a, or(a, b)) folder (PR #138998)

Thomas Raoux llvmlistbot at llvm.org
Tue Jun 3 15:18:13 PDT 2025


================
@@ -2901,6 +2901,15 @@ func.func @andand3(%a : i32, %b : i32) -> i32 {
   return %res : i32
 }
 
+// CHECK-LABEL: @andor
+//  CHECK-SAME:   (%[[A:.*]]: i32, %[[B:.*]]: i32)
+//       CHECK:   return %[[A]]
+func.func @andor(%a : i32, %b : i32) -> i32 {
+  %c = arith.ori %a, %b : i32
+  %res = arith.andi %a, %b : i32
----------------
ThomasRaoux wrote:

should it be `arith.andi %a, %c`?

https://github.com/llvm/llvm-project/pull/138998


More information about the Mlir-commits mailing list