[Mlir-commits] [mlir] [mlir] Use identity map to construct the memref type as possible (PR #183051)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Mon Mar 9 06:41:28 PDT 2026
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 origin/main HEAD --extensions cpp -- mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp mlir/lib/IR/BuiltinTypes.cpp mlir/test/lib/Dialect/Test/TestAttributes.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp b/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp
index 0f796120f..c933b8a23 100644
--- a/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp
+++ b/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp
@@ -3090,8 +3090,7 @@ MemRefType SubViewOp::inferRankReducedResultType(
}
return MemRefType::get(resultShape, inferredType.getElementType(),
StridedLayoutAttr::get(inferredType.getContext(),
- offset,
- rankReducedStrides),
+ offset, rankReducedStrides),
inferredType.getMemorySpace());
}
@@ -3411,10 +3410,10 @@ static MemRefType getCanonicalSubViewResultType(
strides.push_back(stride);
}
- return MemRefType::get(shape, nonRankReducedType.getElementType(),
- StridedLayoutAttr::get(sourceType.getContext(),
- offset, strides),
- nonRankReducedType.getMemorySpace());
+ return MemRefType::get(
+ shape, nonRankReducedType.getElementType(),
+ StridedLayoutAttr::get(sourceType.getContext(), offset, strides),
+ nonRankReducedType.getMemorySpace());
}
Value mlir::memref::createCanonicalRankReducingSubViewOp(
diff --git a/mlir/lib/IR/BuiltinTypes.cpp b/mlir/lib/IR/BuiltinTypes.cpp
index 048910a35..94bc261f0 100644
--- a/mlir/lib/IR/BuiltinTypes.cpp
+++ b/mlir/lib/IR/BuiltinTypes.cpp
@@ -654,7 +654,7 @@ unsigned MemRefType::getMemorySpaceAsInt() const {
}
static int64_t getNumContiguousTrailingDimsImpl(ArrayRef<int64_t> shape,
- ArrayRef<int64_t> strides) {
+ ArrayRef<int64_t> strides) {
const int64_t n = shape.size();
// A memref with dimensions `d0, d1, ..., dn-1` and strides
// `s0, s1, ..., sn-1` is contiguous up to dimension `k`
diff --git a/mlir/test/lib/Dialect/Test/TestAttributes.cpp b/mlir/test/lib/Dialect/Test/TestAttributes.cpp
index db7dfa014..0469f4a09 100644
--- a/mlir/test/lib/Dialect/Test/TestAttributes.cpp
+++ b/mlir/test/lib/Dialect/Test/TestAttributes.cpp
@@ -599,7 +599,7 @@ test::detail::TestCustomStorageCtorAttrAttrStorage::construct(
//===----------------------------------------------------------------------===//
mlir::AffineMap TestMemRefLayoutAttr::getAffineMap() const {
- // Construct a non-identity AffineMap to prevent it from being folded.
+ // Construct a non-identity AffineMap to prevent it from being folded.
return mlir::AffineMap::get(1, 0, {getAffineConstantExpr(0, getContext())});
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/183051
More information about the Mlir-commits
mailing list