[Mlir-commits] [mlir] [MLIR][Tensor] Fix incorrect operand consumption in expand_shape canonicalization (PR #180705)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Tue Feb 10 00:53:35 PST 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/Tensor/IR/TensorOps.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/Tensor/IR/TensorOps.cpp b/mlir/lib/Dialect/Tensor/IR/TensorOps.cpp
index 2d532be7f..34e551071 100644
--- a/mlir/lib/Dialect/Tensor/IR/TensorOps.cpp
+++ b/mlir/lib/Dialect/Tensor/IR/TensorOps.cpp
@@ -2207,8 +2207,8 @@ struct ConvertToStaticExpandShape : public OpRewritePattern<ExpandShapeOp> {
 
     for (const auto &[inputDim, innerReassoc] : llvm::enumerate(reassoc)) {
       for (uint64_t outDim : innerReassoc) {
-        // If the static output shape has a dynamic dim, we must consume an operand
-        // from the input list, even if the result type is static.
+        // If the static output shape has a dynamic dim, we must consume an
+        // operand from the input list, even if the result type is static.
         if (expandOp.getStaticOutputShape()[outDim] == ShapedType::kDynamic) {
           Value val = *outputIt;
           ++outputIt;
@@ -2216,9 +2216,9 @@ struct ConvertToStaticExpandShape : public OpRewritePattern<ExpandShapeOp> {
             continue;
 
           // If the cast's src type is dynamic, don't infer any of the
-          // corresponding expanded dimensions. `tensor.expand_shape` requires at
-          // least one of the expanded dimensions to be dynamic if the input is
-          // dynamic.
+          // corresponding expanded dimensions. `tensor.expand_shape` requires
+          // at least one of the expanded dimensions to be dynamic if the input
+          // is dynamic.
           if (ShapedType::isDynamic(castSrcShape[inputDim])) {
             dynamicOutputShape.push_back(val);
             continue;

``````````

</details>


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


More information about the Mlir-commits mailing list