[Mlir-commits] [mlir] [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 llvmlistbot at llvm.org
Thu Sep 28 01:14:18 PDT 2023


================
@@ -106,6 +111,48 @@ struct DeallocationOptions {
   /// to, an error will already be emitted at compile time. This cannot be
   /// changed with this option.
   bool verifyFunctionBoundaryABI = true;
+
+  /// Given an allocation side-effect on the passed operation, determine whether
+  /// this allocation operation is of relevance (i.e., should assign ownership
+  /// to the allocated value). If it is determined to not be relevant,
+  /// ownership will be set to 'false', i.e., it will be leaked. This is useful
+  /// to support deallocation of multiple different kinds of allocation ops.
+  DetectionFn isRelevantAllocOp = [](Operation *op) {
+    return isa<memref::MemRefDialect, bufferization::BufferizationDialect>(
----------------
matthias-springer wrote:

Why is the bufferization dialect in here? Can we just check for memref.alloc/memref.alloca in here?

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


More information about the Mlir-commits mailing list