[Mlir-commits] [mlir] 7de2e49 - [mlir][NFC] Use Builder for getReassociationIndicesAttribute method. (#137251)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Thu Apr 24 15:16:21 PDT 2025


Author: Han-Chung Wang
Date: 2025-04-24T15:16:18-07:00
New Revision: 7de2e4971f8ad8d12ed617bc66f6d549d2830a57

URL: https://github.com/llvm/llvm-project/commit/7de2e4971f8ad8d12ed617bc66f6d549d2830a57
DIFF: https://github.com/llvm/llvm-project/commit/7de2e4971f8ad8d12ed617bc66f6d549d2830a57.diff

LOG: [mlir][NFC] Use Builder for getReassociationIndicesAttribute method. (#137251)

The method does not need to create any operation, so we can use Builder.
It can be reused by any attribute getter implementation, so it does not
need to declare OpBuilder in the implementation.

Signed-off-by: hanhanW <hanhan0912 at gmail.com>

Added: 
    

Modified: 
    mlir/include/mlir/Dialect/Utils/ReshapeOpsUtils.h
    mlir/lib/Dialect/Utils/ReshapeOpsUtils.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Dialect/Utils/ReshapeOpsUtils.h b/mlir/include/mlir/Dialect/Utils/ReshapeOpsUtils.h
index 3af89a6ab3799..af575e10acc8e 100644
--- a/mlir/include/mlir/Dialect/Utils/ReshapeOpsUtils.h
+++ b/mlir/include/mlir/Dialect/Utils/ReshapeOpsUtils.h
@@ -57,7 +57,7 @@ getSymbolLessAffineMaps(ArrayRef<ReassociationExprs> reassociation);
 
 /// Wraps a list of reassociations in an ArrayAttr.
 ArrayAttr
-getReassociationIndicesAttribute(OpBuilder &b,
+getReassociationIndicesAttribute(Builder &b,
                                  ArrayRef<ReassociationIndices> reassociation);
 
 /// Convert Array<Array<AffineExpr>> to Array<Array<int64_t>>.

diff  --git a/mlir/lib/Dialect/Utils/ReshapeOpsUtils.cpp b/mlir/lib/Dialect/Utils/ReshapeOpsUtils.cpp
index 0336423c57b1d..ed40a080441bc 100644
--- a/mlir/lib/Dialect/Utils/ReshapeOpsUtils.cpp
+++ b/mlir/lib/Dialect/Utils/ReshapeOpsUtils.cpp
@@ -158,7 +158,7 @@ unsigned getMaxPosOfType(ArrayRef<ReassociationExprs> exprArrays) {
 }
 
 ArrayAttr mlir::getReassociationIndicesAttribute(
-    OpBuilder &b, ArrayRef<ReassociationIndices> reassociation) {
+    Builder &b, ArrayRef<ReassociationIndices> reassociation) {
   SmallVector<Attribute, 4> reassociationAttr =
       llvm::to_vector<4>(llvm::map_range(
           reassociation, [&](const ReassociationIndices &indices) -> Attribute {


        


More information about the Mlir-commits mailing list