[Mlir-commits] [mlir] [vector][mlir] Canonicalize to shape_cast where possible (PR #140583)

Matthias Springer llvmlistbot at llvm.org
Wed Dec 17 07:10:33 PST 2025


matthias-springer wrote:

OK, so to summarize, there are cases where transpose => shape_cast is beneficial and cases where shape_cast => transpose is beneficial.

* [transpose => shape_cast](https://github.com/llvm/llvm-project/pull/140583#issuecomment-3663574570): `shape_cast(transpose(shape_cast()))` folding
* [shape_cast => transpose](https://github.com/llvm/llvm-project/pull/140583#issuecomment-3427531081): `contract(transpose())` folding

@newling Are there other cases where transpose => shape_cast canonicalization is beneficial? You can write down the same example with transpose / shape_cast inverted and come to the opposite conclusion.


https://github.com/llvm/llvm-project/pull/140583


More information about the Mlir-commits mailing list