[Mlir-commits] [mlir] [MLIR][Vector] Make vector.extract verifier more strict for partial extractions (PR #186197)
Mehdi Amini
llvmlistbot at llvm.org
Fri Mar 13 05:15:31 PDT 2026
joker-eph wrote:
> Do you have a complete example?
It's in the associated bug. I just reduced it:
```
func.func @fold_vector_extract_type_mismatch(%elt : vector<1xi32>, %vec : vector<5x1xi32> ) -> i32 {
%insert = vector.insert %elt, %vec [0] : vector<1xi32> into vector<5x1xi32>
%extract = vector.extract %insert[0] : i32 from vector<5x1xi32>
return %extract : i32
}
```
This crashes in the folder of extract because it'll return %elt which isn't the right type.
I don't quite get why vector.extract would allow an implicit bitcast here: this does not compose with the rest of the system.
It is possible to have a type system where `i32` and `vector<1xi32>` can be used interchangeably, but that needs to be ubiquitous IMO: this kind of one-off leads to a lot of edge cases, like we see here.
https://github.com/llvm/llvm-project/pull/186197
More information about the Mlir-commits
mailing list