[Mlir-commits] [mlir] [mlir] update `include` create APIs (3/n) (PR #149687)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Sat Jul 19 16:43:29 PDT 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 HEAD~1 HEAD --extensions h -- mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h mlir/include/mlir/Dialect/Bufferization/Transforms/Passes.h mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorType.h mlir/include/mlir/Dialect/Tosa/Utils/ConversionUtils.h mlir/include/mlir/Dialect/Tosa/Utils/QuantUtils.h mlir/include/mlir/Dialect/Utils/ReshapeOpsUtils.h mlir/include/mlir/Dialect/Vector/Utils/VectorUtils.h mlir/include/mlir/IR/Builders.h mlir/include/mlir/Interfaces/ViewLikeInterface.h mlir/include/mlir/Parser/Parser.h
``````````

</details>

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

``````````diff
diff --git a/mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h b/mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h
index bb7f688e7..f3b34f9fd 100644
--- a/mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h
+++ b/mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h
@@ -651,7 +651,8 @@ void replaceOpWithBufferizedValues(RewriterBase &rewriter, Operation *op,
 template <typename OpTy, typename... Args>
 OpTy replaceOpWithNewBufferizedOp(RewriterBase &rewriter, Operation *op,
                                   Args &&...args) {
-  auto newOp = OpTy::create(rewriter, op->getLoc(), std::forward<Args>(args)...);
+  auto newOp =
+      OpTy::create(rewriter, op->getLoc(), std::forward<Args>(args)...);
   replaceOpWithBufferizedValues(rewriter, op, newOp->getResults());
   return newOp;
 }
diff --git a/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorType.h b/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorType.h
index 59da8ba6c..11bede8ff 100644
--- a/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorType.h
+++ b/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorType.h
@@ -131,10 +131,10 @@ public:
   /// ambiguity whenever passing a `SparseTensorType` directly to a
   /// function which is overloaded to accept either `Type` or `TypeRange`.
   /// In particular, this includes `RewriterBase::replaceOpWithNewOp<OpTy>`
-  /// and `OpBuilder::$2::create($1, OpTy>` whenever the `OpTy::build` is overloaded
-  /// thus.  This happens because the `TypeRange<T>(T&&)` ctor is implicit
-  /// as well, and there's no SFINAE we can add to this method that would
-  /// block subsequent application of that ctor.  The only way to fix the
+  /// and `OpBuilder::$2::create($1, OpTy>` whenever the `OpTy::build` is
+  /// overloaded thus.  This happens because the `TypeRange<T>(T&&)` ctor is
+  /// implicit as well, and there's no SFINAE we can add to this method that
+  /// would block subsequent application of that ctor.  The only way to fix the
   /// overload ambiguity is to avoid *implicit* conversion at the callsite:
   /// e.g., by using `static_cast` to make the conversion explicit, by
   /// assigning the `SparseTensorType` to a temporary variable of the
diff --git a/mlir/include/mlir/Dialect/Utils/ReshapeOpsUtils.h b/mlir/include/mlir/Dialect/Utils/ReshapeOpsUtils.h
index 817442e65..6d4ea5b51 100644
--- a/mlir/include/mlir/Dialect/Utils/ReshapeOpsUtils.h
+++ b/mlir/include/mlir/Dialect/Utils/ReshapeOpsUtils.h
@@ -334,8 +334,8 @@ struct ComposeCollapseOfExpandOp : public OpRewritePattern<CollapseOpTy> {
         for (Value v : llvm::drop_begin(dynamicSizes))
           result = arith::MulIOp::create(rewriter, loc, result, v);
         if (numStaticElems != 1) {
-          result = arith::MulIOp::create(rewriter,
-              loc, result,
+          result = arith::MulIOp::create(
+              rewriter, loc, result,
               arith::ConstantIndexOp::create(rewriter, loc, numStaticElems));
         }
         newOutputShape.push_back(result);
diff --git a/mlir/include/mlir/Dialect/Vector/Utils/VectorUtils.h b/mlir/include/mlir/Dialect/Vector/Utils/VectorUtils.h
index 387ec99a8..d68138ace 100644
--- a/mlir/include/mlir/Dialect/Vector/Utils/VectorUtils.h
+++ b/mlir/include/mlir/Dialect/Vector/Utils/VectorUtils.h
@@ -119,8 +119,9 @@ inline auto makeVscaleConstantBuilder(PatternRewriter &rewriter, Location loc) {
   return [loc, vscale, &rewriter](int64_t multiplier) mutable {
     if (!vscale)
       vscale = vector::VectorScaleOp::create(rewriter, loc);
-    return arith::MulIOp::create(rewriter,
-        loc, vscale, arith::ConstantIndexOp::create(rewriter, loc, multiplier));
+    return arith::MulIOp::create(
+        rewriter, loc, vscale,
+        arith::ConstantIndexOp::create(rewriter, loc, multiplier));
   };
 }
 
diff --git a/mlir/include/mlir/Interfaces/ViewLikeInterface.h b/mlir/include/mlir/Interfaces/ViewLikeInterface.h
index 9601c4c73..db9c37fc3 100644
--- a/mlir/include/mlir/Interfaces/ViewLikeInterface.h
+++ b/mlir/include/mlir/Interfaces/ViewLikeInterface.h
@@ -110,7 +110,7 @@ public:
     // Create the new op in canonical form.
     auto newOp =
         OpType::create(rewriter, op.getLoc(), resultType, op.getSource(),
-                                mixedOffsets, mixedSizes, mixedStrides);
+                       mixedOffsets, mixedSizes, mixedStrides);
     CastOpFunc()(rewriter, op, newOp);
 
     return success();

``````````

</details>


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


More information about the Mlir-commits mailing list