[mlir][python] fix constructor generation for optional operands in presence of segmen...
authorAlex Zinenko <zinenko@google.com>
Fri, 5 Nov 2021 11:05:02 +0000 (12:05 +0100)
committerAlex Zinenko <zinenko@google.com>
Fri, 5 Nov 2021 11:40:27 +0000 (12:40 +0100)
commit6981e5ec91c98a23753d2dae590156107d857fda
tree1ca7258d510b99fb0cc7d8fd120a7717b24444d3
parent5e9ac7c0a5fca46e911e23db808fe862b3c127bf
[mlir][python] fix constructor generation for optional operands in presence of segment attribute

The ODS-based Python op bindings generator has been generating incorrect
specification of the operand segment in presence if both optional and variadic
operand groups: optional groups were treated as variadic whereas they require
separate treatement. Make sure it is the case. Also harden the tests around
generated op constructors as they could hitherto accept the code for both
optional and variadic arguments.

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D113259
mlir/lib/Bindings/Python/IRCore.cpp
mlir/test/mlir-tblgen/op-python-bindings.td
mlir/test/python/dialects/vector.py
mlir/tools/mlir-tblgen/OpPythonBindingGen.cpp