[Mlir-commits] [mlir] [MLIR][buffer-deallocation] Introduce copies only for MemRef typed values. (PR #121582)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Tue Jan 14 08:01:33 PST 2025


================
@@ -308,6 +308,9 @@ class BufferDeallocation : public BufferPlacementTransformationBase {
 
     // Add new allocs and additional clone operations.
     for (Value value : valuesToFree) {
+      if (!isa<BaseMemRefType>(value.getType())) {
----------------
erick-xanadu wrote:

Hi @matthias-springer, I implemented the change but I noticed that my test case failed. If I do this, it appears that a deallocation will be placed in the block following the `scf.while` op. This means that the original test fails because the `memref.alloc` inside the `scf.while` body does not dominate the `memref.dealloc` operation that will be inserted. I think that no `memref.dealloc` should be inserted though (but I am not sure) because it is passed to a function which means that the allocated pointer may be stored on the heap or elsewhere. I'll try to take a closer look, but if you have a quick hunch about what can be wrong, please let me know. :) 

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


More information about the Mlir-commits mailing list