collapse/expand_shape are supposed to be expanded before we hit the lowering code.
The expansion is done with the pass called expand-strided-metadata.
This patch is NFC in spirit but not in practice because expand-strided-metadata won't try to accomodate for "invalid" strides for dynamic sizes that are 1 at runtime.
The previous code was broken in that respect too, but differently: it handled only the case of row-major layouts.
That whole part is being reworked separately.