[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
4 files changed
tree: 98880ddcd83500c8551626e0c8c6192b285ab1df
  1. benchmark/
  2. cmake/
  3. docs/
  4. examples/
  5. include/
  6. lib/
  7. python/
  8. test/
  9. tools/
  10. unittests/
  11. utils/
  12. .clang-format
  13. .clang-tidy
  14. CMakeLists.txt
  15. LICENSE.TXT
  16. Maintainers.md
  17. README.md
README.md

Multi-Level Intermediate Representation

See https://mlir.llvm.org/ for more information.