[Mlir-commits] [mlir] [vector][mlir] Canonicalize to shape_cast where possible (PR #140583)
Matthias Springer
llvmlistbot at llvm.org
Wed Dec 17 07:20:05 PST 2025
matthias-springer wrote:
No. What I meant, you can make this argument, which is very similar to @newling's but argues for the opposite canonicalization:
```
%0 = vector.transpose %arg0 [1, 0] : vector<1x4xf32> to vector<4x1xf32>
%1 = vector.shape_cast %0 : vector<4x1xf32> to vector<1x4xf32>
%2 = vector.transpose %1 [1, 0] : vector<1x4xf32> to vector<4x1xf32>
```
==>
```
%0 = vector.transpose %arg0 [1, 0] : vector<1x4xf32> to vector<4x1xf32>
%1 = vector.transpose %0 [1, 0] : vector<4x1xf32> to vector<1x4xf32>
%2 = vector.transpose %1 [1, 0] : vector<1x4xf32> to vector<4x1xf32>
```
==>
```
%0 = vector.transpose %arg0 [1, 0] : vector<1x4xf32> to vector<4x1xf32>
```
https://github.com/llvm/llvm-project/pull/140583
More information about the Mlir-commits
mailing list