[Mlir-commits] [mlir] 48c28d5 - [mlir] Unranked memref type has no rank

Jacques Pienaar llvmlistbot at llvm.org
Mon Jun 8 18:08:35 PDT 2020


Author: Jacques Pienaar
Date: 2020-06-08T18:08:14-07:00
New Revision: 48c28d58c6f2f80c4ebe84d89bb61f740a958463

URL: https://github.com/llvm/llvm-project/commit/48c28d58c6f2f80c4ebe84d89bb61f740a958463
DIFF: https://github.com/llvm/llvm-project/commit/48c28d58c6f2f80c4ebe84d89bb61f740a958463.diff

LOG: [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

Added: 
    

Modified: 
    mlir/lib/IR/StandardTypes.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/IR/StandardTypes.cpp b/mlir/lib/IR/StandardTypes.cpp
index 7a823ee49cfd..117cd6810968 100644
--- a/mlir/lib/IR/StandardTypes.cpp
+++ b/mlir/lib/IR/StandardTypes.cpp
@@ -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");


        


More information about the Mlir-commits mailing list