[Mlir-commits] [mlir] [mlir][IR] Improve error message when return type could not be inferred (PR #112336)

lorenzo chelini llvmlistbot at llvm.org
Wed Oct 16 09:08:36 PDT 2024


================
@@ -247,3 +247,17 @@ LogicalResult mlir::detail::verifyInferredResultTypes(Operation *op) {
 
   return result;
 }
+
+void mlir::detail::reportFatalInferReturnTypesError(OperationState &state) {
+  std::string buffer;
+  llvm::raw_string_ostream os(buffer);
+  os << "Failed to infer result type(s):\n";
+  os << "\"" << state.name << "\"(...) ";
+  os << state.attributes.getDictionary(state.location.getContext());
+  os << " : (";
+  llvm::interleaveComma(state.operands, os,
+                        [&](Value val) { os << val.getType(); });
+  os << ") -> ( ??? )";
+  mlir::emitRemark(state.location, "location of op");
----------------
chelini wrote:

nit: can we avoid prefixing with mlir::?

https://github.com/llvm/llvm-project/pull/112336


More information about the Mlir-commits mailing list