// dimensions, extracts the size from the memref descriptor.
auto memrefSize = [int64Ty, pos, i64cst](MemRefType type, Value *memref,
int dim) -> Value * {
- assert(static_cast<size_t>(dim) < type.getRank());
+ assert(dim < type.getRank());
if (type.getShape()[dim] != -1) {
return i64cst(type.getShape()[dim]);
}
ArrayRef<Value *> indexings) {
MemRefType memRefType = memRef->getType().cast<MemRefType>();
result->addOperands({memRef});
- assert(indexings.size() == memRefType.getRank() &&
+ assert(indexings.size() == static_cast<size_t>(memRefType.getRank()) &&
"unexpected number of indexings (must match the memref rank)");
result->addOperands(indexings);
if (!memRefType)
return parser->emitError(parser->getNameLoc(),
"memRef type expected for first type");
- if (indexingsInfo.size() != memRefType.getRank())
+ if (indexingsInfo.size() != static_cast<size_t>(memRefType.getRank()))
return parser->emitError(parser->getNameLoc(),
"expected " + Twine(memRefType.getRank()) +
" indexings");
return parser->emitError(parser->getNameLoc(), "view type expected");
ArrayRef<Type> indexingTypes = ArrayRef<Type>(types).drop_front().drop_back();
- if (indexingTypes.size() != memRefType.getRank())
+ if (indexingTypes.size() != static_cast<size_t>(memRefType.getRank()))
return parser->emitError(parser->getNameLoc(),
"expected " + Twine(memRefType.getRank()) +
" indexing types");
location);
}
- // TODO(b/132735995) Get rid of this unsigned override.
- unsigned getRank() const { return getShape().size(); }
-
ArrayRef<int64_t> getShape() const;
/// Returns an array of affine map pointers representing the memref affine
auto indexAttr = op.getAttrOfType<IntegerAttr>("index");
if (!indexAttr)
return op.emitOpError("requires an integer attribute named 'index'");
- uint64_t index = indexAttr.getValue().getZExtValue();
+ int64_t index = indexAttr.getValue().getSExtValue();
auto type = op.getOperand()->getType();
if (auto tensorType = type.dyn_cast<RankedTensorType>()) {
- if (index >= static_cast<uint64_t>(tensorType.getRank()))
+ if (index >= tensorType.getRank())
return op.emitOpError("index is out of range");
} else if (auto memrefType = type.dyn_cast<MemRefType>()) {
if (index >= memrefType.getRank())
}
// Check that source/destination index list size matches associated rank.
- if (srcIndexInfos.size() != types[0].cast<MemRefType>().getRank() ||
- dstIndexInfos.size() != types[1].cast<MemRefType>().getRank())
+ if (srcIndexInfos.size() !=
+ static_cast<size_t>(types[0].cast<MemRefType>().getRank()) ||
+ dstIndexInfos.size() !=
+ static_cast<size_t>(types[1].cast<MemRefType>().getRank()))
return parser->emitError(parser->getNameLoc(),
"memref rank not equal to indices count");
- if (tagIndexInfos.size() != types[2].cast<MemRefType>().getRank())
+ if (tagIndexInfos.size() !=
+ static_cast<size_t>(types[2].cast<MemRefType>().getRank()))
return parser->emitError(parser->getNameLoc(),
"tag memref rank not equal to indices count");
return parser->emitError(parser->getNameLoc(),
"expected tag to be of memref type");
- if (tagIndexInfos.size() != type.cast<MemRefType>().getRank())
+ if (tagIndexInfos.size() !=
+ static_cast<size_t>(type.cast<MemRefType>().getRank()))
return parser->emitError(parser->getNameLoc(),
"tag memref rank not equal to indices count");
// Extract optional paddingValue.
// At this point, indexInfo may contain the optional paddingValue, pop it out.
- if (indexInfo.size() != memrefType.getRank())
+ if (indexInfo.size() != static_cast<size_t>(memrefType.getRank()))
return parser->emitError(parser->getNameLoc(),
"expected " + Twine(memrefType.getRank()) +
" indices to the memref");