[mlir][vector] Drop leading unit dims in memref op folding (#197278)
Make the IndexedAccessOpInterface implementations for vector dialect
operations a bit smarter by letting them drop redundant unit dimensions
and shape_cast operations back. This allows folding in, for example, an
expand_shape of a 1-D memref to a load of a `vector<1x1x8xf32>` by
turning it into a load of a `vector<8xf32>` instead. This functionality
is somewhat reduntant with dropleadunitdims, but is included for
completeness and to better match the interface contract of
IndexedAccessOpInterface.
While we're here, fix a bug in the verifier of
vector.expandshape/collapsestore - as near as I can tell, they were
meant to check for the mask being the
same shape is the input vector, but they just checked the first
dimension.
AI: Co-authored by Codex 5.5 (which also caught a bunch of my old typos)