Skip to content

Commit

Permalink
[mlir] Unranked memref type has no rank
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jpienaar committed Jun 9, 2020
1 parent 0e1accd commit 48c28d5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mlir/lib/IR/StandardTypes.cpp
Expand Up @@ -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");
Expand Down

0 comments on commit 48c28d5

Please sign in to comment.