This generalizes this pattern to support dynamic shapes, and the source memref is no longer flattened all the way to 1D. Only a sufficient number of innermost dimensions are collapsed, to match the number of elements of the vectorType (which is still being flattened to 1D).
Not flattening the outer dimensions of the memrefType is key to simple, correct handling of the indices for these outer dims: we can just keep those as-is, whereas if we kept the flattening of all those outer dims, we would have to generate arithmetic to compute the correct flattened index.
This pattern was also conflating another thing into it: a helper was calling rankReducingSubviewDroppingUnitDims, which was duplicating the work of the other patterns Transfer{Read,Write}DropUnitDimsPattern. This is dropped. That didn't seem to break anything, possibly because whichever places needed that were also adding those patterns anyway. The reason why I specifically needed to drop that now was that conflating that was making the logic here really messy.
Nit: remove braces