[Mlir-commits] [mlir] [mlir] [memref] [transform] Add alloc_to_global op. (PR #211141)
Federico Bruzzone
llvmlistbot at llvm.org
Wed Aug 5 05:34:28 PDT 2026
https://github.com/FedericoBruzzone commented:
Thanks a lot for iterating on this PR @beamandala, really appreciated! 🫶
Overall, SGTM the approach. Can we add some tests to cover the following cases?
1. As pointed out by @matthias-springer, the following case is not supported. Currently, the PR produce an _unsound_ code. Now, I don't know if it's better prevent this or simply document the invariant. What do you think folks?
```mlir
func.func @via_select(%c: i1) {
%0 = memref.alloc() : memref<2xf32>
%1 = memref.alloc() : memref<2xf32>
%2 = arith.select %c, %0, %1 : memref<2xf32>
memref.dealloc %2 : memref<2xf32>
return
}
```
2. Both survive the transform with the dealloc intact. Should we prevent this too?
```mlir
%r = scf.if %c -> memref<2xf32> { scf.yield %0 } else { scf.yield %1 }
memref.dealloc %r : memref<2xf32>
```
```mlir
cf.cond_br %c, ^bb1(%0 : memref<2xf32>), ^bb1(%1 : memref<2xf32>)
^bb1(%a: memref<2xf32>):
memref.dealloc %a : memref<2xf32>
```
https://github.com/llvm/llvm-project/pull/211141
More information about the Mlir-commits
mailing list