[Mlir-commits] [mlir] [mlir] Improve dialect conversion failure diagnostics (PR #182729)
Matthias Springer
llvmlistbot at llvm.org
Sun Mar 1 23:21:26 PST 2026
================
@@ -57,6 +59,20 @@ static void logFailure(llvm::ScopedPrinter &os, StringRef fmt, Args &&...args) {
});
}
+/// Format a conversion pattern as "root-op -> (generated-op, ...)".
+static std::string formatPatternForDiagnostics(const Pattern &pattern) {
+ std::string patternStr;
+ llvm::raw_string_ostream os(patternStr);
+ if (std::optional<OperationName> root = pattern.getRootKind())
+ os << root->getStringRef();
+ else
+ os << "*";
+ os << " -> (";
+ llvm::interleaveComma(pattern.getGeneratedOps(), os);
----------------
matthias-springer wrote:
I would drop `getGeneratedOps`. The vast majority of patterns do not populate this field.
https://github.com/llvm/llvm-project/pull/182729
More information about the Mlir-commits
mailing list