This is an archive of the discontinued LLVM Phabricator instance.

[mlir][python] Infer result types in generated constructors whenever possible
ClosedPublic

Authored by ftynse on Oct 14 2021, 8:19 AM.

Details

Summary

In several cases, operation result types can be unambiguously inferred from
operands and attributes at operation construction time. Stop requiring the user
to provide these types as arguments in the ODS-generated constructors in Python
bindings. In particular, handle the SameOperandAndResultTypes and
FirstAttrDerivedResultType traits as well as InferTypeOpInterface using the
recently added interface support. This is a significant usability improvement
for IR construction, similar to what C++ ODS provides.

Depends On D111656

Diff Detail

Event Timeline

ftynse created this revision.Oct 14 2021, 8:19 AM
ftynse requested review of this revision.Oct 14 2021, 8:19 AM

Would you mind sending a PSA on discourse: There is a lot of code out there that may need result type elided with this change.

gysit accepted this revision.Oct 21 2021, 2:27 AM

LGTM!

This revision is now accepted and ready to land.Oct 21 2021, 2:27 AM
ftynse updated this revision to Diff 381920.Oct 25 2021, 3:50 AM

Fix mismerge.

This revision was landed with ongoing or failed builds.Oct 25 2021, 3:51 AM
This revision was automatically updated to reflect the committed changes.