VectorTransferLoweringPatterns can be enabled via a pass option. These additional patterns lower permutation maps to minor identity maps with broadcasting, if possible, allowing for more efficient vector load/stores. The option is deactivated by default.
Depends On D102566
The use of benefit looks a bit odd to me here. This isn't really a problem of cost model but more a phase ordering problem. we currently don't pick a phase ordering using benefit so far so that seems a bit weird to me. I think you could just apply the pattern separately before, would that not give the same result?
I mean something like:
I'm also wondering if it really needs to be done in this pass or it could be something handled at the strategy level but I don't have all the context there so it may be better that way.