[Mlir-commits] [mlir] [mlir][bufferization] Ownership-based deallocation: Allow manual (de)allocs (PR #68648)

Mehdi Amini llvmlistbot at llvm.org
Wed Jan 3 02:34:34 PST 2024


================
@@ -856,13 +857,32 @@ FailureOr<Operation *> BufferDeallocation::handleInterface(CallOpInterface op) {
 FailureOr<Operation *>
 BufferDeallocation::handleInterface(MemoryEffectOpInterface op) {
   auto *block = op->getBlock();
+  OpBuilder builder = OpBuilder::atBlockBegin(block);
 
-  for (auto operand : llvm::make_filter_range(op->getOperands(), isMemref))
-    if (op.getEffectOnValue<MemoryEffects::Free>(operand).has_value())
-      return op->emitError(
-          "memory free side-effect on MemRef value not supported!");
+  for (auto operand : llvm::make_filter_range(op->getOperands(), isMemref)) {
+    if (op.getEffectOnValue<MemoryEffects::Free>(operand).has_value()) {
+      if (!op->hasAttr(BufferizationDialect::kManualDeallocation))
+        return op->emitError(
+            "memory free side-effect on MemRef value not supported!");
----------------
joker-eph wrote:

I don't quite get this message here? It does not seems to relate to the conditions that lead here, or am I missing something?

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


More information about the Mlir-commits mailing list