[llvm] [mlir][bufferization] Add deallocation option to remove existing dealloc operations, add option to specify the kind of alloc operations to consider (PR #67556)

Matthias Springer via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 28 01:14:21 PDT 2023


================
@@ -839,8 +852,15 @@ BufferDeallocation::handleInterface(MemoryEffectOpInterface op) {
         continue;
       }
 
-      state.updateOwnership(res, buildBoolValue(builder, op.getLoc(), true));
-      state.addMemrefToDeallocate(res, block);
+      if (options.isRelevantAllocOp(op)) {
+        state.updateOwnership(res, buildBoolValue(builder, op.getLoc(), true));
+        state.addMemrefToDeallocate(res, block);
+        continue;
+      }
+
+      // Alloc operations from other dialects are expected to have matching
+      // deallocation operations inserted by another pass.
----------------
matthias-springer wrote:

`inserted by a separate run of this pass`

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


More information about the llvm-commits mailing list