[Mlir-commits] [mlir] [mlir][Utils] Add verifyRanksMatch helper (NFC) (PR #175880)

Nick Kreeger llvmlistbot at llvm.org
Sat Jan 17 07:53:59 PST 2026


================
@@ -2126,13 +2127,11 @@ LogicalResult tosa::PadOp::verify() {
   if (!inputType || !outputType)
     return success();
 
-  auto inputRank = inputType.getRank();
-  auto outputRank = outputType.getRank();
-  if (inputRank != outputRank)
-    return emitOpError() << "expect same input and output tensor rank, but got "
-                         << "inputRank: " << inputRank
-                         << ", outputRank: " << outputRank;
+  if (failed(verifyRanksMatch(getOperation(), inputType, outputType, "input",
----------------
nkreeger wrote:

Yeah - things changed under the hood, the build fails because `this` in a TOSA op's verify method is a pointer to the concrete op type (e.g., `tosa::PadOp *`), not `Operation *`.

I got this, and reverted back:
```
  error: no matching function for call to 'verifyRanksMatch'
  note: candidate function not viable: no known conversion from 'mlir::tosa::PadOp *' to 'Operation *' for 1st argument
```

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


More information about the Mlir-commits mailing list