[Mlir-commits] [mlir] [mlir] Add missing materialization function diag for dialect convertion (PR #207689)

lonely eagle llvmlistbot at llvm.org
Mon Jul 6 05:21:17 PDT 2026


linuxlonelyeagle wrote:

> Based on the changed test cases, this just renames the error message, but does not add any extra information. How does that help?

This is the original logic. As you can see, when the statements in both if conditions evaluate to false, an error is thrown via the final diag. However, for the nested if statement, this specific error message is inaccurate and makes debugging quite difficult. I actually ran into this exact issue today, which I also mentioned in the PR description.
```
  // Try to materialize the conversion.
  if (const TypeConverter *converter = info.getConverter()) {
    if (!newMaterialization.empty()) {
       return success();
     }
  }

  InFlightDiagnostic diag = op->emitError()
                            << "failed to legalize unresolved materialization "
                               "from ("
                            << inputOperands.getTypes() << ") to ("
                            << op.getResultTypes()
                            << ") that remained live after conversion";
  diag.attachNote(op->getUsers().begin()->getLoc())
      << "see existing live user here: " << *op->getUsers().begin();
  return failure();
}
```


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


More information about the Mlir-commits mailing list