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 @@ -1120,7 +1120,8 @@ auto fn = op.getParentOfType().lookupSymbol(fnAttr.getValue()); if (!fn) - return op.emitOpError("reference to undefined function 'bar'"); + return op.emitOpError() + << "reference to undefined function '" << fnAttr.getValue() << "'"; // Check that the referenced function has the correct type. if (fn.getType() != type) diff --git a/mlir/test/IR/invalid.mlir b/mlir/test/IR/invalid.mlir --- a/mlir/test/IR/invalid.mlir +++ b/mlir/test/IR/invalid.mlir @@ -513,7 +513,7 @@ func @undefined_function() { ^bb0: - %x = constant @bar : (i32) -> () // expected-error {{reference to undefined function 'bar'}} + %x = constant @qux : (i32) -> () // expected-error {{reference to undefined function 'qux'}} return }