[Mlir-commits] [mlir] [mlir][bufferize] Make drop-equivalent-buffer-results support mult blocks (PR #163388)

Matthias Springer llvmlistbot at llvm.org
Fri Oct 17 01:58:50 PDT 2025


================
@@ -72,40 +92,44 @@ mlir::bufferization::dropEquivalentBufferResults(ModuleOp module) {
   for (auto funcOp : module.getOps<func::FuncOp>()) {
     if (funcOp.isExternal() || funcOp.isPublic())
       continue;
-    func::ReturnOp returnOp = getAssumedUniqueReturnOp(funcOp);
-    // TODO: Support functions with multiple blocks.
-    if (!returnOp)
+    SmallVector<func::ReturnOp> returnOps = getReturnOps(funcOp);
+    if (returnOps.empty())
       continue;
+    func::ReturnOp returnOp = returnOps.front();
 
     // Compute erased results.
-    SmallVector<Value> newReturnValues;
+    SmallVector<SmallVector<Value>> newReturnValues(returnOps.size());
----------------
matthias-springer wrote:

nit: Can you add helper variables for better readability: `numReturnOps` and `numReturnValues`.

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


More information about the Mlir-commits mailing list