[Mlir-commits] [mlir] [mlir][linalg][nfc] Code refactoring of LinalgOps.cpp (PR #164274)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon Oct 20 08:55:42 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 origin/main HEAD --extensions cpp,h -- mlir/lib/Dialect/Linalg/IR/RegionBuilderHelper.cpp mlir/lib/Dialect/Linalg/IR/RegionBuilderHelper.h mlir/lib/Dialect/Linalg/IR/LinalgOps.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/Linalg/IR/RegionBuilderHelper.cpp b/mlir/lib/Dialect/Linalg/IR/RegionBuilderHelper.cpp
index b1b6dd8af..8e4b7e98e 100644
--- a/mlir/lib/Dialect/Linalg/IR/RegionBuilderHelper.cpp
+++ b/mlir/lib/Dialect/Linalg/IR/RegionBuilderHelper.cpp
@@ -45,7 +45,7 @@ Value RegionBuilderHelper::buildUnaryFn(
     auto one = arith::ConstantOp::create(builder, arg.getLoc(),
                                          llvm::cast<TypedAttr>(oneAttr));
     return arith::DivFOp::create(builder, arg.getLoc(), one, arg);
-  }  
+  }
   case UnaryFn::round:
     return math::RoundOp::create(builder, arg.getLoc(), arg);
   case UnaryFn::sqrt:
@@ -59,7 +59,7 @@ Value RegionBuilderHelper::buildUnaryFn(
   case UnaryFn::erf:
     return math::ErfOp::create(builder, arg.getLoc(), arg);
   }
-  
+
   if (emitError) {
     emitError() << "unsupported unary function";
     return nullptr;
diff --git a/mlir/lib/Dialect/Linalg/IR/RegionBuilderHelper.h b/mlir/lib/Dialect/Linalg/IR/RegionBuilderHelper.h
index de0edac8a..646650d1d 100644
--- a/mlir/lib/Dialect/Linalg/IR/RegionBuilderHelper.h
+++ b/mlir/lib/Dialect/Linalg/IR/RegionBuilderHelper.h
@@ -29,10 +29,10 @@
 #ifndef MLIR_LINALG_REGION_BUILDER_HELPER_H
 #define MLIR_LINALG_REGION_BUILDER_HELPER_H
 
-#include "mlir/Dialect/Linalg/IR/Linalg.h"
 #include "mlir/Dialect/Arith/IR/Arith.h"
 #include "mlir/Dialect/Arith/Utils/Utils.h"
 #include "mlir/Dialect/Complex/IR/Complex.h"
+#include "mlir/Dialect/Linalg/IR/Linalg.h"
 #include "mlir/Dialect/Math/IR/Math.h"
 #include "mlir/Dialect/MemRef/IR/MemRef.h"
 #include "mlir/Dialect/Tensor/IR/Tensor.h"
@@ -88,7 +88,7 @@ public:
   Value buildTypeFn(TypeFn typeFn, Type toType, Value operand,
                     function_ref<InFlightDiagnostic()> emitError = {});
 
-  // Create a `yieldOp` to yield `values` passed in arg.                      
+  // Create a `yieldOp` to yield `values` passed in arg.
   void yieldOutputs(ValueRange values);
 
   // Create a constant op with value parsed from string `value`.

``````````

</details>


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


More information about the Mlir-commits mailing list