Replace checks against numDynamicDims with hasStaticShape
authorGeoffrey Martin-Noble <gcmn@google.com>
Thu, 30 May 2019 23:02:49 +0000 (16:02 -0700)
committerMehdi Amini <joker.eph@gmail.com>
Sun, 2 Jun 2019 03:11:31 +0000 (20:11 -0700)
--

PiperOrigin-RevId: 250782165

mlir/lib/Analysis/Utils.cpp
mlir/lib/ExecutionEngine/MemRefUtils.cpp
mlir/lib/Transforms/DmaGeneration.cpp

index 3026074..59ab8f7 100644 (file)
@@ -365,7 +365,7 @@ Optional<int64_t> MemRefRegion::getRegionSize() {
 /// size of the vector as well.
 //  TODO(mlir-team): improve/complete this when we have target data.
 Optional<uint64_t> mlir::getMemRefSizeInBytes(MemRefType memRefType) {
-  if (memRefType.getNumDynamicDims() > 0)
+  if (!memRefType.hasStaticShape())
     return None;
   auto elementType = memRefType.getElementType();
   if (!elementType.isIntOrFloat() && !elementType.isa<VectorType>())
index 280fb0d..5163603 100644 (file)
@@ -41,7 +41,7 @@ allocMemRefDescriptor(Type type, bool allocateData = true,
   auto memRefType = type.dyn_cast<MemRefType>();
   if (!memRefType)
     return make_string_error("non-memref argument not supported");
-  if (memRefType.getNumDynamicDims() != 0)
+  if (!memRefType.hasStaticShape())
     return make_string_error("memref with dynamic shapes not supported");
 
   auto elementType = memRefType.getElementType();
index 1436627..1ead2e5 100644 (file)
@@ -186,7 +186,7 @@ static bool getFullMemRefAsRegion(Operation *opInst, unsigned numParamLoopIVs,
     return false;
   }
   auto memRefType = region->memref->getType().cast<MemRefType>();
-  if (memRefType.getNumDynamicDims() > 0)
+  if (!memRefType.hasStaticShape())
     return false;
 
   auto *regionCst = region->getConstraints();