[all-commits] [llvm/llvm-project] 2a30bf: [mlir] Improve error message when number of operan...

Markus Böck via All-commits all-commits at lists.llvm.org
Wed Dec 4 00:36:26 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2a30bfcef368667247ebbe30be84f73b92dbe800
      https://github.com/llvm/llvm-project/commit/2a30bfcef368667247ebbe30be84f73b92dbe800
  Author: Markus Böck <markus.boeck02 at gmail.com>
  Date:   2024-12-04 (Wed, 04 Dec 2024)

  Changed paths:
    M mlir/include/mlir/IR/OpImplementation.h
    M mlir/test/Dialect/LLVMIR/invalid.mlir
    M mlir/test/Dialect/Linalg/transform-ops-invalid.mlir
    M mlir/test/Dialect/SCF/invalid.mlir
    M mlir/test/Dialect/SPIRV/IR/memory-ops.mlir
    M mlir/test/Dialect/Tensor/invalid.mlir
    M mlir/test/Dialect/Vector/invalid.mlir

  Log Message:
  -----------
  [mlir] Improve error message when number of operands and types differ (#118488)

If using a variadic operand, the error message given if the number of
types and operands do not match would be along the lines of:
```
3 operands present, but expected 2
```

This error message is confusing for multiple reasons, particular for
beginners:
* If the intention is to have 3 operands, it does not point out why it
expects 2. The user may actually just want to add a type to the type
list
* It reads as if a verifier error rather than a parser error, giving the
impression the Op only supports 2 operands.

This PR attempts to improve the error message by first noting the issue
("number of operands and types mismatch") and mentioning how many
operands and types it received.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list