Index: mlir/lib/Dialect/Arith/IR/ArithOps.cpp =================================================================== --- mlir/lib/Dialect/Arith/IR/ArithOps.cpp +++ mlir/lib/Dialect/Arith/IR/ArithOps.cpp @@ -887,8 +887,6 @@ //===----------------------------------------------------------------------===// OpFoldResult arith::MaxFOp::fold(ArrayRef operands) { - assert(operands.size() == 2 && "maxf takes two operands"); - // maxf(x,x) -> x if (getLhs() == getRhs()) return getRhs(); @@ -907,8 +905,6 @@ //===----------------------------------------------------------------------===// OpFoldResult MaxSIOp::fold(ArrayRef operands) { - assert(operands.size() == 2 && "binary operation takes two operands"); - // maxsi(x,x) -> x if (getLhs() == getRhs()) return getRhs(); @@ -935,8 +931,6 @@ //===----------------------------------------------------------------------===// OpFoldResult MaxUIOp::fold(ArrayRef operands) { - assert(operands.size() == 2 && "binary operation takes two operands"); - // maxui(x,x) -> x if (getLhs() == getRhs()) return getRhs(); @@ -961,8 +955,6 @@ //===----------------------------------------------------------------------===// OpFoldResult arith::MinFOp::fold(ArrayRef operands) { - assert(operands.size() == 2 && "minf takes two operands"); - // minf(x,x) -> x if (getLhs() == getRhs()) return getRhs(); @@ -981,8 +973,6 @@ //===----------------------------------------------------------------------===// OpFoldResult MinSIOp::fold(ArrayRef operands) { - assert(operands.size() == 2 && "binary operation takes two operands"); - // minsi(x,x) -> x if (getLhs() == getRhs()) return getRhs(); @@ -1009,8 +999,6 @@ //===----------------------------------------------------------------------===// OpFoldResult MinUIOp::fold(ArrayRef operands) { - assert(operands.size() == 2 && "binary operation takes two operands"); - // minui(x,x) -> x if (getLhs() == getRhs()) return getRhs(); @@ -1245,8 +1233,6 @@ //===----------------------------------------------------------------------===// OpFoldResult arith::TruncIOp::fold(ArrayRef operands) { - assert(operands.size() == 1 && "unary operation takes one operand"); - // trunci(zexti(a)) -> a // trunci(sexti(a)) -> a if (matchPattern(getOperand(), m_Op()) || @@ -1293,8 +1279,6 @@ /// Perform safe const propagation for truncf, i.e. only propagate if FP value /// can be represented without precision loss or rounding. OpFoldResult arith::TruncFOp::fold(ArrayRef operands) { - assert(operands.size() == 1 && "unary operation takes one operand"); - auto constOperand = operands.front(); if (!constOperand || !constOperand.isa()) return {}; @@ -1535,8 +1519,6 @@ } OpFoldResult arith::BitcastOp::fold(ArrayRef operands) { - assert(operands.size() == 1 && "bitcast op expects 1 operand"); - auto resType = getType(); auto operand = operands[0]; if (!operand) @@ -1653,8 +1635,6 @@ } OpFoldResult arith::CmpIOp::fold(ArrayRef operands) { - assert(operands.size() == 2 && "cmpi takes two operands"); - // cmpi(pred, x, x) if (getLhs() == getRhs()) { auto val = applyCmpPredicateToEqualOperands(getPredicate()); @@ -1774,8 +1754,6 @@ } OpFoldResult arith::CmpFOp::fold(ArrayRef operands) { - assert(operands.size() == 2 && "cmpf takes two operands"); - auto lhs = operands.front().dyn_cast_or_null(); auto rhs = operands.back().dyn_cast_or_null();