[mlir] Unranked memref type has no rank

Summary:
UnrankedMemRefType doesn't have a rank but previously this was just
checking for unranked tensor. Avoids failure later if one queries the shape
post checking if ranked.

Differential Revision: https://reviews.llvm.org/D81441
This commit is contained in:
Jacques Pienaar 2020-06-08 18:00:35 -07:00
parent 0e1accd0f7
commit 48c28d58c6

View File

@ -199,7 +199,9 @@ int64_t ShapedType::getNumElements() const {
int64_t ShapedType::getRank() const { return getShape().size(); }
bool ShapedType::hasRank() const { return !isa<UnrankedTensorType>(); }
bool ShapedType::hasRank() const {
return !isa<UnrankedMemRefType>() && !isa<UnrankedTensorType>();
}
int64_t ShapedType::getDimSize(unsigned idx) const {
assert(idx < getRank() && "invalid index for shaped type");