[Mlir-commits] [mlir] [mlir][Utils] Add verifyElementTypesMatch helper (NFC) (PR #176668)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Sun Jan 18 14:00:46 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 h,cpp -- mlir/include/mlir/Dialect/Utils/VerificationUtils.h mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp mlir/lib/Dialect/Utils/VerificationUtils.cpp mlir/lib/Dialect/Vector/IR/VectorOps.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/Utils/VerificationUtils.cpp b/mlir/lib/Dialect/Utils/VerificationUtils.cpp
index 95a3348d5..bb51581e1 100644
--- a/mlir/lib/Dialect/Utils/VerificationUtils.cpp
+++ b/mlir/lib/Dialect/Utils/VerificationUtils.cpp
@@ -43,10 +43,9 @@ LogicalResult mlir::verifyElementTypesMatch(Operation *op, ShapedType lhs,
   Type lhsElementType = lhs.getElementType();
   Type rhsElementType = rhs.getElementType();
   if (lhsElementType != rhsElementType) {
-    return op->emitOpError()
-           << lhsName << " element type (" << lhsElementType
-           << ") does not match " << rhsName << " element type ("
-           << rhsElementType << ")";
+    return op->emitOpError() << lhsName << " element type (" << lhsElementType
+                             << ") does not match " << rhsName
+                             << " element type (" << rhsElementType << ")";
   }
   return success();
 }
diff --git a/mlir/lib/Dialect/Vector/IR/VectorOps.cpp b/mlir/lib/Dialect/Vector/IR/VectorOps.cpp
index 3f8d6b523..7efba9860 100644
--- a/mlir/lib/Dialect/Vector/IR/VectorOps.cpp
+++ b/mlir/lib/Dialect/Vector/IR/VectorOps.cpp
@@ -5930,8 +5930,8 @@ LogicalResult MaskedLoadOp::verify() {
   VectorType resVType = getVectorType();
   MemRefType memType = getMemRefType();
 
-  if (failed(verifyElementTypesMatch(*this, memType, resVType, "base",
-                                     "result")))
+  if (failed(
+          verifyElementTypesMatch(*this, memType, resVType, "base", "result")))
     return failure();
   if (llvm::size(getIndices()) != memType.getRank())
     return emitOpError("requires ") << memType.getRank() << " indices";
@@ -6051,8 +6051,8 @@ LogicalResult GatherOp::verify() {
   if (!llvm::isa<MemRefType, RankedTensorType>(baseType))
     return emitOpError("requires base to be a memref or ranked tensor type");
 
-  if (failed(verifyElementTypesMatch(*this, baseType, resVType, "base",
-                                     "result")))
+  if (failed(
+          verifyElementTypesMatch(*this, baseType, resVType, "base", "result")))
     return failure();
   if (llvm::size(getOffsets()) != baseType.getRank())
     return emitOpError("requires ") << baseType.getRank() << " indices";
@@ -6245,8 +6245,8 @@ LogicalResult ExpandLoadOp::verify() {
   VectorType resVType = getVectorType();
   MemRefType memType = getMemRefType();
 
-  if (failed(verifyElementTypesMatch(*this, memType, resVType, "base",
-                                     "result")))
+  if (failed(
+          verifyElementTypesMatch(*this, memType, resVType, "base", "result")))
     return failure();
   if (llvm::size(getIndices()) != memType.getRank())
     return emitOpError("requires ") << memType.getRank() << " indices";

``````````

</details>


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


More information about the Mlir-commits mailing list