llvm-project
29cd7921 - [MLIR][Python] Add get_parent_of_type helper (#185512)

Commit
56 days ago
[MLIR][Python] Add get_parent_of_type helper (#185512) The `op.parent` only returns the immediate parent, in which case downstream users have to traverse the operation by themselves to find a specific type op. This PR adds a python function `get_parent_of_type()` to mlir.ir to provide an API to do so. The function mirrors the implementation here: https://github.com/llvm/llvm-project/blob/main/mlir/include/mlir/IR/Operation.h#L257-L273. Instead of creating a new binding, reimplement it in python using `isinstance()` is simpler.
Author
Parents
Loading