[Mlir-commits] [mlir] [mlir][vector] Fix invalid `LoadOp` indices being created (PR #75519)
Benjamin Maxwell
llvmlistbot at llvm.org
Sat Dec 16 09:02:12 PST 2023
================
@@ -1615,8 +1615,10 @@ GetGlobalOp::verifySymbolUses(SymbolTableCollection &symbolTable) {
//===----------------------------------------------------------------------===//
LogicalResult LoadOp::verify() {
- if (getNumOperands() != 1 + getMemRefType().getRank())
- return emitOpError("incorrect number of indices for load");
+ if (getNumOperands() - 1 != getMemRefType().getRank()) {
+ return emitOpError("incorrect number of indices for load, expected ")
+ << getMemRefType().getRank() << " but got " << getNumOperands() - 1;
+ }
----------------
MacDue wrote:
I may be missing something obvious :sweat_smile:, but is there a reason why this is not just:
```suggestion
if (getIndices().size() != getMemRefType().getRank()) {
return emitOpError("incorrect number of indices for load, expected ")
<< getMemRefType().getRank() << " but got " <<getIndices().size();
}
```
https://github.com/llvm/llvm-project/pull/75519
More information about the Mlir-commits
mailing list