[MLIR][LinAlg] Use AnyTypeOf for LinalgOperand for better error msg.
authorVincent Zhao <vincentzhaorz@gmail.com>
Wed, 5 Aug 2020 18:06:17 +0000 (20:06 +0200)
committerAlex Zinenko <zinenko@google.com>
Wed, 5 Aug 2020 18:13:45 +0000 (20:13 +0200)
commitb727cfed5e765d099f47e6785f962695408977c0
tree4d931ca3675c7ea02fb5a95d71ec63874269ffab
parent4f20f5e8cffca7898d62070e4fcd51650e412e98
[MLIR][LinAlg] Use AnyTypeOf for LinalgOperand for better error msg.

Previously, `LinalgOperand` is defined with `Type<Or<..,>>`, which produces
not very readable error messages when it is not matched, e.g.,

```
'linalg.generic' op operand #0 must be anonymous_326, but got ....
```

It is simply because the `description` property is not properly set.

This diff switches to use `AnyTypeOf` for `LinalgOperand`, which automatically
generates a description based on the allowed types provided.

As a result, the error message now becomes:

```
'linalg.generic' op operand #0 must be ranked tensor of any type values or strided memref of any type values, but got ...
```

Which is clearer and more informative.

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D84428
mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td