[Mlir-commits] [mlir] [mlir][mem2reg] Promote memory slots through transparent view operations (PR #196924)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Fri May 22 06:49:36 PDT 2026


https://github.com/jeanPerier commented:

Thanks @gysit and @Moxinilian for the thorough reviews and feedback!

> If the infra could intelligently reuse projections in those cases, that would be nice.

Yeah, I agree. I initially tried that a bit, but the handling of this over block/regions was adding quite some complexity. For the use case I have in FIR, I do expect that the redundant bitcasts/insert/extract will be folded away by canonicalization (except when block/region arguments are needed). Most of the common use case I have have "transparent" alias that do not change the element type, so no extra IR is projected for projections. Hence I think this is a change/optimization that should be left for some use case. It should be doable to do it in the framework without modifying the APIs.

> Do you intend to implement the interface for memref.view (for example) as a reference implementation? It would be useful to have one upstream. But I'm no memref expert, if it's too complicated we can find something else later.

I was not, I have one ready for FIR (needs a few updates after the APIs changes). I agree that memref is a better place to set precedents. I can give it a try in a separate patch if that is OK with you?

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


More information about the Mlir-commits mailing list