[Mlir-commits] [mlir] [MLIR] Determine contiguousness of memrefs with a dynamic dimension (PR #140872)

Andrzej WarzyƄski llvmlistbot at llvm.org
Thu May 29 08:18:44 PDT 2025


================
@@ -649,7 +649,10 @@ bool MemRefType::areTrailingDimsContiguous(int64_t n) {
   if (!isLastDimUnitStride())
     return false;
 
-  auto memrefShape = getShape().take_back(n);
+  if (n == 1)
+    return true;
+
+  auto memrefShape = getShape().take_back(n - 1);
----------------
banach-space wrote:

[nit] Could you add comments explaining what makes `n == 1` and the last `n-1` dims special? Alternatively, rename `n` to e.g. `numTrailingDimsToCheck` (or something else self-documenting). 

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


More information about the Mlir-commits mailing list