I noticed that BufferizeTypeConverter has two quirky features that seem like separable concerns. They were both introduced in https://reviews.llvm.org/D85133 without any explanation as to why they had to be part of BufferizeTypeConverter. I’d like to understand to what extent we can separate them. The two features are:
Ability to convert memrefs to out-params. It seems like this can be done as a very simple separate pass, totally orthogonal to bufferization. I put together a patch that does so here: https://reviews.llvm.org/D90071
Decomposing types such as tuple types on function boundaries. This again seems like a separable calling convention translation. Additionally, I searched all of github and google’s internal codebase and couldn’t find a user of this code, so we may be able to even fully remove it. I have a patch that does so here: https://reviews.llvm.org/D89990
Thoughts? If we cleanly factor out these two things, then we will have a really nice and clean bufferization infrastructure. It’s currently quite hard to follow the current function/call/return lowering code because of these features being (unnecessarily?) intertwined.