[Mlir-commits] [mlir] [mlir][python] Correctly handle python passes that emit errors without signalling failure. (PR #96996)

Oleksandr Alex Zinenko llvmlistbot at llvm.org
Mon Jul 8 13:25:52 PDT 2024


================
@@ -123,12 +123,28 @@ void mlir::python::populatePassManagerSubmodule(py::module &m) {
               op.getOperation().getContext()->clearOperationsInside(op);
             }
             // Actually run the pass manager.
-            PyMlirContext::ErrorCapture errors(op.getOperation().getContext());
+            PyMlirContext::ErrorCapture error_capture(
+                op.getOperation().getContext());
             MlirLogicalResult status = mlirPassManagerRunOnOp(
                 passManager.get(), op.getOperation().get());
-            if (mlirLogicalResultIsFailure(status))
+            auto errors = error_capture.take();
----------------
ftynse wrote:

```suggestion
            auto errors = errorCapture.take();
```

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


More information about the Mlir-commits mailing list