[Mlir-commits] [mlir] [MLIR][Python] Expose the insertion point of pattern rewriter (PR #161001)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Sat Oct 4 08:50:32 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};
+  }
+
+  return wrap(std::addressof(*it));
----------------
PragmaTwice wrote:

Fixed in https://github.com/llvm/llvm-project/pull/161001/commits/4d406f66c66959fac35804ee5ae12054c2534374 : )

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


More information about the Mlir-commits mailing list