[Mlir-commits] [mlir] [mlir][bufferization] Handle scf.if deallocs in static memory planner (PR #213634)

Matthias Springer llvmlistbot at llvm.org
Mon Aug 3 03:03:00 PDT 2026


================
@@ -147,12 +188,22 @@ collectCandidates(FunctionOpInterface funcOp, llvm::Statistic &numSkipDynamic,
     }
 
     for (memref::DeallocOp d : deallocs) {
-      if (d->getBlock() != allocOp->getBlock()) {
-        allocOp.emitError("dealloc is in a different block than the alloc; "
+      // The dealloc must be anchored in the plan block (directly or via an
+      // enclosing op such as an scf.if). A dealloc in a sibling block escapes.
+      if (!planBlock->findAncestorOpInBlock(*d.getOperation())) {
+        allocOp.emitError("dealloc is not reachable from the alloc's block; "
----------------
matthias-springer wrote:

Rephrase: "unstructured control flow is not supported"

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


More information about the Mlir-commits mailing list