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

llvmlistbot at llvm.org llvmlistbot at llvm.org
Fri Oct 3 21:48:29 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:

Sorry for the unclear. I'm out right now so cannot change the type soon. I'll revisit it tonight.

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


More information about the Mlir-commits mailing list