[Mlir-commits] [mlir] [MLIR][MemRef] Normalize memref.alloc ops with non trivial layout map (PR #129875)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed Mar 5 04:11:13 PST 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 6d93280aabc2fd132f54e5aa615d25abeadabe7b 9f3b4a9e5cacad4fe355ef0d52a858a21474e067 --extensions cpp -- mlir/lib/Analysis/FlatLinearValueConstraints.cpp mlir/lib/Dialect/Affine/Utils/Utils.cpp mlir/lib/Dialect/MemRef/Transforms/NormalizeMemRefs.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/mlir/lib/Dialect/Affine/Utils/Utils.cpp b/mlir/lib/Dialect/Affine/Utils/Utils.cpp
index 6671d981f2..df630dbd43 100644
--- a/mlir/lib/Dialect/Affine/Utils/Utils.cpp
+++ b/mlir/lib/Dialect/Affine/Utils/Utils.cpp
@@ -1848,9 +1848,9 @@ LogicalResult mlir::affine::normalizeMemRef(AllocLikeOp *allocOp) {
       dimensionOperands.push_back(
           b.create<AffineApplyOp>(allocOp->getLoc(), resMap, mapOperands));
     }
-    newAlloc = b.create<AllocLikeOp>(allocOp->getLoc(), newMemRefType,
-                                             dimensionOperands,
-                                             allocOp->getAlignmentAttr());
+    newAlloc =
+        b.create<AllocLikeOp>(allocOp->getLoc(), newMemRefType,
+                              dimensionOperands, allocOp->getAlignmentAttr());
   }
   // Replace all uses of the old memref.
   if (failed(replaceAllMemRefUsesWith(oldMemRef, /*newMemRef=*/newAlloc,
@@ -1939,11 +1939,11 @@ MemRefType mlir::affine::normalizeMemRefType(MemRefType memrefType) {
     // invalid for normalization. If dimension of new memrefType is dynamic,
     // the value is `ShapedType::kDynamic`.
     if (!ubConst.has_value())
-        newShape[d] = ShapedType::kDynamic;
-      else if (*ubConst >= 0)
-        newShape[d] = *ubConst + 1;
-      else
-        return memrefType;
+      newShape[d] = ShapedType::kDynamic;
+    else if (*ubConst >= 0)
+      newShape[d] = *ubConst + 1;
+    else
+      return memrefType;
   }
 
   // Create the new memref type after trivializing the old layout map.

``````````

</details>


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


More information about the Mlir-commits mailing list