[Mlir-commits] [mlir] Draft: [mlir][tosa] Fix unranked tosa canonicalizations crashes (PR #188188)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Tue Mar 24 20:48:21 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/Tosa/IR/TosaCanonicalizations.cpp mlir/lib/Dialect/Tosa/Transforms/TosaFolders.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/Tosa/IR/TosaCanonicalizations.cpp b/mlir/lib/Dialect/Tosa/IR/TosaCanonicalizations.cpp
index c5bbba937..b95e6819d 100644
--- a/mlir/lib/Dialect/Tosa/IR/TosaCanonicalizations.cpp
+++ b/mlir/lib/Dialect/Tosa/IR/TosaCanonicalizations.cpp
@@ -1766,8 +1766,8 @@ OpFoldResult ReverseOp::fold(FoldAdaptor adaptor) {
   bool noOpReverse =
       llvm::isa_and_nonnull<SplatElementsAttr>(adaptor.getInput1());
   // If the dim-length is 1, or reversing axis is unit-dim, also a no-op.
-  noOpReverse |= (operandTy.hasRank() &&
-      (operandTy.getRank() == 0 || operandTy.getDimSize(axis) == 1));
+  noOpReverse |= (operandTy.hasRank() && (operandTy.getRank() == 0 ||
+                                          operandTy.getDimSize(axis) == 1));
   if (noOpReverse)
     return foldToInputIfTypeMatches(*this, operand);
   return {};

``````````

</details>


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


More information about the Mlir-commits mailing list