diff --git a/mlir/lib/Dialect/Arith/Transforms/ExpandOps.cpp b/mlir/lib/Dialect/Arith/Transforms/ExpandOps.cpp --- a/mlir/lib/Dialect/Arith/Transforms/ExpandOps.cpp +++ b/mlir/lib/Dialect/Arith/Transforms/ExpandOps.cpp @@ -179,22 +179,6 @@ } }; -template -struct MaxMinIOpConverter : public OpRewritePattern { -public: - using OpRewritePattern::OpRewritePattern; - LogicalResult matchAndRewrite(OpTy op, - PatternRewriter &rewriter) const final { - Value lhs = op.getLhs(); - Value rhs = op.getRhs(); - - Location loc = op.getLoc(); - Value cmp = rewriter.create(loc, pred, lhs, rhs); - rewriter.replaceOpWithNewOp(op, cmp, lhs, rhs); - return success(); - } -}; - struct ArithExpandOpsPass : public arith::impl::ArithExpandOpsBase { void runOnOperation() override { @@ -210,11 +194,7 @@ arith::CeilDivUIOp, arith::FloorDivSIOp, arith::MaxFOp, - arith::MaxSIOp, - arith::MaxUIOp, - arith::MinFOp, - arith::MinSIOp, - arith::MinUIOp + arith::MinFOp >(); // clang-format on if (failed(applyPartialConversion(getOperation(), target, @@ -237,11 +217,7 @@ // clang-format off patterns.add< MaxMinFOpConverter, - MaxMinFOpConverter, - MaxMinIOpConverter, - MaxMinIOpConverter, - MaxMinIOpConverter, - MaxMinIOpConverter + MaxMinFOpConverter >(patterns.getContext()); // clang-format on } diff --git a/mlir/test/Dialect/Arith/expand-ops.mlir b/mlir/test/Dialect/Arith/expand-ops.mlir --- a/mlir/test/Dialect/Arith/expand-ops.mlir +++ b/mlir/test/Dialect/Arith/expand-ops.mlir @@ -187,46 +187,3 @@ // CHECK-NEXT: %[[IS_NAN:.*]] = arith.cmpf uno, %[[RHS]], %[[RHS]] : f32 // CHECK-NEXT: %[[RESULT:.*]] = arith.select %[[IS_NAN]], %[[RHS]], %[[SELECT]] : f32 // CHECK-NEXT: return %[[RESULT]] : f32 - - -// ----- - -// CHECK-LABEL: func @maxsi -func.func @maxsi(%a: i32, %b: i32) -> i32 { - %result = arith.maxsi %a, %b : i32 - return %result : i32 -} -// CHECK-SAME: %[[LHS:.*]]: i32, %[[RHS:.*]]: i32) -// CHECK-NEXT: %[[CMP:.*]] = arith.cmpi sgt, %[[LHS]], %[[RHS]] : i32 - -// ----- - -// CHECK-LABEL: func @minsi -func.func @minsi(%a: i32, %b: i32) -> i32 { - %result = arith.minsi %a, %b : i32 - return %result : i32 -} -// CHECK-SAME: %[[LHS:.*]]: i32, %[[RHS:.*]]: i32) -// CHECK-NEXT: %[[CMP:.*]] = arith.cmpi slt, %[[LHS]], %[[RHS]] : i32 - - -// ----- - -// CHECK-LABEL: func @maxui -func.func @maxui(%a: i32, %b: i32) -> i32 { - %result = arith.maxui %a, %b : i32 - return %result : i32 -} -// CHECK-SAME: %[[LHS:.*]]: i32, %[[RHS:.*]]: i32) -// CHECK-NEXT: %[[CMP:.*]] = arith.cmpi ugt, %[[LHS]], %[[RHS]] : i32 - - -// ----- - -// CHECK-LABEL: func @minui -func.func @minui(%a: i32, %b: i32) -> i32 { - %result = arith.minui %a, %b : i32 - return %result : i32 -} -// CHECK-SAME: %[[LHS:.*]]: i32, %[[RHS:.*]]: i32) -// CHECK-NEXT: %[[CMP:.*]] = arith.cmpi ult, %[[LHS]], %[[RHS]] : i32