[Mlir-commits] [mlir] [mlir][vector] Add verification for incorrect vector.extract (PR #115824)
Andrzej WarzyĆski
llvmlistbot at llvm.org
Wed Nov 13 04:48:30 PST 2024
https://github.com/banach-space commented:
The unification of the logic for `vector.insert` and `vector.extract` is great, thank you!
In "invalid.mlir", I mostly see tests for `vector.extract`? I guess you want to make sure you have the right set and then create similar tests for `vector.insert`?
Looking at `verifyInsertExtractIndices`, which is already nice and tidy, it could be made even easier to follow (IMHO) if you split it like this (3 big cases instead of 2):
```cpp
if (extracting 0D vector) {
// some code + return->emitOpError
return success();
}
if (extracting nD vector) // including 1D {
// some code + return->emitOpError
return success();
}
if (extracting scalar) {
// some code + return->emitOpError
return success();
}
```
Bonus points for avoiding `else if`, but that's just a nice-to-have.
https://github.com/llvm/llvm-project/pull/115824
More information about the Mlir-commits
mailing list