[DDR] Introduce implicit equality check for the source pattern operands with the...
authorrdzhabarov <rdzhabarov@google.com>
Wed, 14 Oct 2020 17:51:16 +0000 (10:51 -0700)
committerJacques Pienaar <jpienaar@google.com>
Wed, 14 Oct 2020 18:05:13 +0000 (11:05 -0700)
commit008c0ea6a4115101694aab0451c89754dee1a5de
tree1142fab2e5ccf35c2e130ecfeebe736921b868ff
parentff30bff136743817dae66029f512cdb3a009937f
[DDR] Introduce implicit equality check for the source pattern operands with the same name.

This CL allows user to specify the same name for the operands in the source pattern which implicitly enforces equality on operands with the same name.
E.g., Pat<(OpA $a, $b, $a) ... > would create a matching rule for checking equality for the first and the last operands. Equality of the operands is enforced at any depth, e.g., OpA ($a, $b, OpB($a, $c, OpC ($a))).

Example usage: Pat<(Reshape $arg0, (Shape $arg0)), (replaceWithValue $arg0)>

Note, this feature only covers operands but not attributes.
Current use cases are based on the operand equality and explicitly add the constraint into the pattern. Attribute equality will be worked out on the different CL.

Reviewed By: jpienaar

Differential Revision: https://reviews.llvm.org/D89254
mlir/include/mlir/TableGen/Pattern.h
mlir/lib/TableGen/Pattern.cpp
mlir/test/lib/Dialect/Test/TestOps.td
mlir/test/mlir-tblgen/pattern.mlir
mlir/tools/mlir-tblgen/RewriterGen.cpp