diff --git a/mlir/lib/Bindings/Python/IRCore.cpp b/mlir/lib/Bindings/Python/IRCore.cpp --- a/mlir/lib/Bindings/Python/IRCore.cpp +++ b/mlir/lib/Bindings/Python/IRCore.cpp @@ -2277,6 +2277,9 @@ c.def_property_readonly("types", [](PyOpResultList &self) { return getValueTypes(self, self.operation->getContext()); }); + c.def_property_readonly("owner", [](PyOpResultList &self) { + return self.operation->createOpView(); + }); } private: diff --git a/mlir/test/python/ir/operation.py b/mlir/test/python/ir/operation.py --- a/mlir/test/python/ir/operation.py +++ b/mlir/test/python/ir/operation.py @@ -440,9 +440,11 @@ r""" func.func @f1() { %0:3 = call @f2() : () -> (i32, f64, index) + call @f3() : () -> () return } func.func private @f2() -> (i32, f64, index) + func.func private @f3() -> () """, ctx, ) @@ -465,6 +467,10 @@ expect_index_error(lambda: call.results[3]) expect_index_error(lambda: call.results[-4]) + no_results_call = caller.regions[0].blocks[0].operations[1] + assert len(no_results_call.results) == 0 + assert no_results_call.results.owner == no_results_call + # CHECK-LABEL: TEST: testOperationResultListSlice @run