Skip to content

[mlir] [arith] Remove buggy illegal operation in --arith-unsigned-when-equivalent #87298

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 2, 2024

Conversation

math-fehr
Copy link
Contributor

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.

@llvmbot
Copy link
Member

llvmbot commented Apr 2, 2024

@llvm/pr-subscribers-mlir

@llvm/pr-subscribers-mlir-arith

Author: Fehr Mathieu (math-fehr)

Changes

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.


Full diff: https://github.com/llvm/llvm-project/pull/87298.diff

1 Files Affected:

  • (modified) mlir/lib/Dialect/Arith/Transforms/UnsignedWhenEquivalent.cpp (+5-6)
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));

@math-fehr math-fehr merged commit e03f16f into llvm:main Apr 2, 2024
@math-fehr math-fehr deleted the fehr/fix-unsigned-when-equivalent branch April 2, 2024 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants