[Mlir-commits] [mlir] 42de94f - [mlir] do not hardcode the name of the undefined function in the error message
Alex Zinenko
llvmlistbot at llvm.org
Mon Jun 29 01:05:16 PDT 2020
Author: Alex Zinenko
Date: 2020-06-29T10:05:06+02:00
New Revision: 42de94f839f259950df7bb142e8f2bb388825a06
URL: https://github.com/llvm/llvm-project/commit/42de94f839f259950df7bb142e8f2bb388825a06
DIFF: https://github.com/llvm/llvm-project/commit/42de94f839f259950df7bb142e8f2bb388825a06.diff
LOG: [mlir] do not hardcode the name of the undefined function in the error message
The error message in the `std.constant` verifier for function-typed constants
had the name of the undefined function hardcoded to `bar`. Report the actual
name instead.
Differential Revision: https://reviews.llvm.org/D82666
Added:
Modified:
mlir/lib/Dialect/StandardOps/IR/Ops.cpp
mlir/test/IR/invalid.mlir
Removed:
################################################################################
diff --git a/mlir/lib/Dialect/StandardOps/IR/Ops.cpp b/mlir/lib/Dialect/StandardOps/IR/Ops.cpp
index 6e6ad47d3141..8df99378868b 100644
--- a/mlir/lib/Dialect/StandardOps/IR/Ops.cpp
+++ b/mlir/lib/Dialect/StandardOps/IR/Ops.cpp
@@ -1120,7 +1120,8 @@ static LogicalResult verify(ConstantOp &op) {
auto fn =
op.getParentOfType<ModuleOp>().lookupSymbol<FuncOp>(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
index f075215bb829..f025fdf3ba4d 100644
--- a/mlir/test/IR/invalid.mlir
+++ b/mlir/test/IR/invalid.mlir
@@ -513,7 +513,7 @@ func @foo() {
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
}
More information about the Mlir-commits
mailing list