[Mlir-commits] [mlir] [MLIR] Determine contiguousness of memrefs with dynamic dimensions (PR #142421)

James Newling llvmlistbot at llvm.org
Thu Jun 5 07:47:34 PDT 2025


================
@@ -646,35 +646,43 @@ LogicalResult MemRefType::verify(function_ref<InFlightDiagnostic()> emitError,
 }
 
 bool MemRefType::areTrailingDimsContiguous(int64_t n) {
-  if (!isLastDimUnitStride())
-    return false;
+  return getMaxContiguousTrailingDims() >= std::min(n, getRank());
----------------
newling wrote:

```suggestion
  assert(n <= getRank() && "doesn't have this many trailing dims to check for contiguity");
  return getMaxContiguousTrailingDims() >= n;
```

Maybe? Trying to understand the logic for the case where n > getRank(). 



https://github.com/llvm/llvm-project/pull/142421


More information about the Mlir-commits mailing list