diff --git a/mlir/lib/Dialect/StandardOps/IR/Ops.cpp b/mlir/lib/Dialect/StandardOps/IR/Ops.cpp --- a/mlir/lib/Dialect/StandardOps/IR/Ops.cpp +++ b/mlir/lib/Dialect/StandardOps/IR/Ops.cpp @@ -2010,15 +2010,16 @@ const auto &results = function.getType().getResults(); if (op.getNumOperands() != results.size()) return op.emitOpError("has ") - << op.getNumOperands() - << " operands, but enclosing function returns " << results.size(); + << op.getNumOperands() << " operands, but enclosing function (" + << function.getName() << ") returns " << results.size(); for (unsigned i = 0, e = results.size(); i != e; ++i) if (op.getOperand(i).getType() != results[i]) return op.emitError() << "type of return operand " << i << " (" << op.getOperand(i).getType() - << ") doesn't match function result type (" << results[i] << ")"; + << ") doesn't match function result type (" << results[i] << ")" + << " in function " << function.getName(); return success(); }