[mlir] Compose expand of collapse to cast (#172864) In some cases `y = expand(collapse(x))` cannot be folded into x, since x and y have different types. In that case, we check if the two types are cast compatible. If they are, it means the two types have compatible shape and layout and y can be folded into cast(x). This causes a change in memref::CastOp::areCastCompatible, where now a dim of size 1 may have different strides. GitOrigin-RevId: 4ccf926e7f075724e3206f92623c8e00d1d34417
See https://mlir.llvm.org/ for more information.