This is an archive of the discontinued LLVM Phabricator instance.

[mlir][python] Fix issues with block argument slices
ClosedPublic

Authored by ftynse on Jul 21 2022, 7:16 AM.

Details

Summary

The type extraction helper function for block argument and op result
list objects was ignoring the slice entirely. So was the slice addition.
Both are caused by a misleading naming convention to implement slices
via CRTP. Make the convention more explicit and hide the helper
functions so users have harder time calling them directly.

Closes #56540.

Diff Detail

Event Timeline

ftynse created this revision.Jul 21 2022, 7:16 AM
ftynse requested review of this revision.Jul 21 2022, 7:16 AM
stellaraccident accepted this revision.Jul 21 2022, 7:33 AM

Good catch, and thank you!

This revision is now accepted and ready to land.Jul 21 2022, 7:33 AM
jpienaar added inline comments.
mlir/lib/Bindings/Python/IRCore.cpp
1972

Could this be a range based loop?

ftynse marked an inline comment as done.Jul 21 2022, 7:37 AM
ftynse added inline comments.
mlir/lib/Bindings/Python/IRCore.cpp
1972

There are no iterators in the Container class. We can do auto i : llvm::seq<int>(0, container.size())) but I am not convinced that improves readability.

This revision was automatically updated to reflect the committed changes.
ftynse marked an inline comment as done.

Awesome, thanks! I confirm that this makes the code run that I had initially problems with!