The new pattern gets rid of the collapse_shape operation while materializing its effects on the sizes, and the strides of the base object.
In other words, this simplification replaces:
baseBuffer, offset, sizes, strides =
extract_strided_metadata(collapse_shape(memref))With
baseBuffer, offset, baseSizes, baseStrides =
extract_strided_metadata(memref)
for reassDim in {0 .. collapseRank - 1}
sizes#reassDim = product(baseSizes#i for i in group[reassDim])
strides#reassDim = baseStrides[group[reassDim].back()]Note: baseBuffer and offset are unaffected by the collapse_shape operation.
Note: I can split the commit with the NFC part first. This would be one of the changes in that commit.