[Mlir-commits] [mlir] [mlir][bufferization] Fix bug when moving dealloc operation (PR #229296)

Pranav Alavandi llvmlistbot at llvm.org
Mon Oct 12 20:02:16 PDT 2026


================

----------------
pranavalavandi wrote:

I _think_ it is just a missed optimization

Consider this example:
```mlir
  %a = memref.alloc() : memref<8xf32>
  %b = memref.alloc() : memref<8xf32>
  %s = arith.select %cond, %a, %b : memref<8xf32>
  %c0 = arith.constant 0 : index
  %x = memref.load %a[%c0] : memref<8xf32>
  memref.dealloc %s : memref<8xf32>
  return
```
So I ran it through the code and nothing happens. The `findUserWithFreeSideEffect` which gives us the candidate `deallocOp` only gives us operations that directly use the the allocation result. So the optimisation never runs.

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


More information about the Mlir-commits mailing list