[Mlir-commits] [mlir] [MLIR][Python] Expose the insertion point of pattern rewriter (PR #161001)
Maksim Levental
llvmlistbot at llvm.org
Fri Oct 3 21:20:10 PDT 2025
================
@@ -70,6 +70,18 @@ MlirBlock mlirRewriterBaseGetBlock(MlirRewriterBase rewriter) {
return wrap(unwrap(rewriter)->getBlock());
}
+MlirOperation
+mlirRewriterBaseGetOperationAfterInsertion(MlirRewriterBase rewriter) {
+ mlir::RewriterBase *base = unwrap(rewriter);
+ mlir::Block *block = base->getInsertionBlock();
+ auto it = base->getInsertionPoint();
+ if (it == block->end()) {
+ return {nullptr};
+ }
----------------
makslevental wrote:
```suggestion
PyInsertionPoint it = base->getInsertionPoint();
if (it == block->end())
return {nullptr};
```
https://github.com/llvm/llvm-project/pull/161001
More information about the Mlir-commits
mailing list