diff --git a/mlir/lib/Dialect/Shape/IR/Shape.cpp b/mlir/lib/Dialect/Shape/IR/Shape.cpp --- a/mlir/lib/Dialect/Shape/IR/Shape.cpp +++ b/mlir/lib/Dialect/Shape/IR/Shape.cpp @@ -490,16 +490,12 @@ LogicalResult matchAndRewrite(OpTy op, PatternRewriter &rewriter) const override { // Find unique operands. - SmallVector unique; - for (Value v : op.getOperands()) { - if (!llvm::is_contained(unique, v)) - unique.push_back(v); - } + SetVector unique(op.operand_begin(), op.operand_end()); // Reduce op to equivalent with unique operands. if (unique.size() < op.getNumOperands()) { - rewriter.replaceOpWithNewOp(op, op->getResultTypes(), unique, - op->getAttrs()); + rewriter.replaceOpWithNewOp(op, op->getResultTypes(), + unique.takeVector(), op->getAttrs()); return success(); } @@ -919,7 +915,7 @@ } LogicalResult CstrBroadcastableOp::verify() { - // Ensure that AssumingAllOp contains at least one operand + // Ensure that CstrBroadcastableOp contains at least two operands if (getNumOperands() < 2) return emitOpError("required at least 2 input shapes"); return success();