message: [NFC] Move CustomOp verification to a better place
diff: @@ -758,6 +758,22 @@ OpFoldResult ConcatenationOp::fold(ArrayRef<Attribute> operands) {
  return new_concat.getResult();
  }
  +//===----------------------------------------------------------------------===//
  +// CustomOp
  +//===----------------------------------------------------------------------===//
  +
  +static LogicalResult Verify(CustomOp op) {
  + OpaqueElementsAttr opaque_attr =
  + op.custom_option().cast<OpaqueElementsAttr>();
  + if (!opaque_attr.getType().hasStaticShape())
  + return op.emitOpError("custom_option should have a static shape.");
  + if (opaque_attr.getValue().size() !=
  + opaque_attr.getType().cast<ShapedType>().getDimSize(0))
  + return op.emitOpError(
  + "custom_option should have the same length of content with shape.");
  + return success();
  +}
  +
  //===----------------------------------------------------------------------===//
  // FullyConnectedOp
  //===----------------------------------------------------------------------===//
  @@ -2169,6 +2185,10 @@ static LogicalResult Verify(TransposeOp op) {
  return success();
  }
  +//===----------------------------------------------------------------------===//
  +// WhileOp
  +//===----------------------------------------------------------------------===//
  +
  LogicalResult Verify(WhileOp op) {
  if (op.getNumOperands() != op.getNumResults())
  return op.emitOpError(llvm::formatv(
  @@ -2178,18 +2198,6 @@ LogicalResult Verify(WhileOp op) {
  return success();
  }
  -static LogicalResult Verify(CustomOp op) {
  - OpaqueElementsAttr opaque_attr =
  - op.custom_option().cast<OpaqueElementsAttr>();
  - if (!opaque_attr.getType().hasStaticShape())
  - return op.emitOpError("custom_option should have a static shape.");
  - if (opaque_attr.getValue().size() !=
  - opaque_attr.getType().cast<ShapedType>().getDimSize(0))
  - return op.emitOpError(
  - "custom_option should have the same length of content with shape.");
  - return success();
  -}
  -
  namespace {
  // Canonicalize While op so that results and operands match and external values
  // are via implicit capture rather than via block args.
  