[Mlir-commits] [mlir] [mlir][bufferization] Buffer deallocation: Make op preconditions stricter (PR #75127)

Aart Bik llvmlistbot at llvm.org
Fri Jan 19 09:42:53 PST 2024


================
@@ -491,7 +502,29 @@ BufferDeallocation::verifyFunctionPreconditions(FunctionOpInterface op) {
 }
 
 LogicalResult BufferDeallocation::verifyOperationPreconditions(Operation *op) {
-  // (1) Check that the control flow structures are supported.
+  // (1) The pass does not work properly when deallocations are already present.
+  // Alternatively, we could also remove all deallocations as a pre-pass.
+  if (isa<DeallocOp>(op))
+    return op->emitError(
+        "No deallocation operations must be present when running this pass!");
+
+  // (2) Memory side effects of unregistered ops are unknown. In particular, we
+  // do not know whether an unregistered op allocates memory or not. Call ops
+  // typically do not implement the MemoryEffectOpInterface but usually do not
+  // have side effects (apart from the callee, which will be analyzed
+  // separately), so they are allowed.
----------------
aartbik wrote:

It would read better if you move the "are allowed" up in the sentence (so that it does not dangle after the exception given in parenthesis)

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


More information about the Mlir-commits mailing list