[Mlir-commits] [mlir] [mlir] [arith] Remove buggy illegal operation in --arith-unsigned-when-equivalent (PR #87298)

Fehr Mathieu llvmlistbot at llvm.org
Mon Apr 1 17:48:31 PDT 2024


https://github.com/math-fehr created https://github.com/llvm/llvm-project/pull/87298

`CeilDivUIOp`  seemed to have been added by mistake to the list of dynamically
illegal operations in `arith-unsigned-when-equivalent`. The only illegal operations
should be the signed operations that can be converted to their unsigned counterpart.

>From f134bf5eb1951e46d3cfaf71bd804c824ba57f20 Mon Sep 17 00:00:00 2001
From: Mathieu Fehr <mathieu.fehr at gmail.com>
Date: Tue, 2 Apr 2024 01:32:24 +0100
Subject: [PATCH] Remove operation that shouldn't have been marked illegal

---
 .../Arith/Transforms/UnsignedWhenEquivalent.cpp       | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/mlir/lib/Dialect/Arith/Transforms/UnsignedWhenEquivalent.cpp b/mlir/lib/Dialect/Arith/Transforms/UnsignedWhenEquivalent.cpp
index 53f2008324f054..4edce84bafd416 100644
--- a/mlir/lib/Dialect/Arith/Transforms/UnsignedWhenEquivalent.cpp
+++ b/mlir/lib/Dialect/Arith/Transforms/UnsignedWhenEquivalent.cpp
@@ -125,12 +125,11 @@ struct ArithUnsignedWhenEquivalentPass
 
     ConversionTarget target(*ctx);
     target.addLegalDialect<ArithDialect>();
-    target
-        .addDynamicallyLegalOp<DivSIOp, CeilDivSIOp, CeilDivUIOp, FloorDivSIOp,
-                               RemSIOp, MinSIOp, MaxSIOp, ExtSIOp>(
-            [&solver](Operation *op) -> std::optional<bool> {
-              return failed(staticallyNonNegative(solver, op));
-            });
+    target.addDynamicallyLegalOp<DivSIOp, CeilDivSIOp, FloorDivSIOp, RemSIOp,
+                                 MinSIOp, MaxSIOp, ExtSIOp>(
+        [&solver](Operation *op) -> std::optional<bool> {
+          return failed(staticallyNonNegative(solver, op));
+        });
     target.addDynamicallyLegalOp<CmpIOp>(
         [&solver](CmpIOp op) -> std::optional<bool> {
           return failed(isCmpIConvertable(solver, op));



More information about the Mlir-commits mailing list