[Mlir-commits] [mlir] [mlir][vector] Fold vector extract from insert when trailing unit dims (PR #192109)
Kunwar Grover
llvmlistbot at llvm.org
Wed Apr 15 07:27:55 PDT 2026
Groverkss wrote:
> The folding makes sense to me but I think we should generate a `vector.from_elements ... : vector<1xf32>`. We've been using that and insert/extract to cross the scalar/vector boundary and we have more folder/canonicalization patters on that front that could simplify the code further.
Not sure if that works for:
```
%vec1 = vector.insert %src into %vec[0, 0] : vector<1xf32> into vector<16x1x1xf32>
%vec2 = vector.extract %vec1[0] : vector<1x1xf32> from vector<16x1x1xf32>
```
This can be written as:
```
%vec2 = vector.broadcast %src : vector<1xf32> to vector<1x1xf32>
```
https://github.com/llvm/llvm-project/pull/192109
More information about the Mlir-commits
mailing list