[MLIR] Introduce constraint attributes for DenseArrayAttr
authorLorenzo Chelini <l.chelini@icloud.com>
Tue, 29 Nov 2022 18:45:37 +0000 (19:45 +0100)
committerLorenzo Chelini <l.chelini@icloud.com>
Thu, 1 Dec 2022 14:15:32 +0000 (15:15 +0100)
commitdd0de4dca92cd6affafb47f788b64e99187168f1
tree0db14815e6c961c7c5fc5d6fd53c758d6898f886
parent2ab7c7e50a85bf9c528e92f566b0551ede6ad5b2
[MLIR] Introduce constraint attributes for DenseArrayAttr

- `DenseArrayStrictlyPositive` all elements are required to be > 0.
  Returns true if the range is empty.

- `DenseArrayNonNegative` all elements are required to be >= 0. Returns
  true if the range is empty.

Both constraints will simplify verifier logic as we move from using `I64ArrayAttr` to `DenseI64ArrayAttr`.

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D138988
mlir/include/mlir/IR/OpBase.td
mlir/test/IR/attribute.mlir
mlir/test/lib/Dialect/Test/TestOps.td