This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Fix `AffineMap.dropResults`.
ClosedPublic

Authored by olegshyshkov on Oct 27 2022, 3:38 AM.

Details

Summary

AffineMap.dropResult erases one result from the array and it changes indexing. Calling dropResult is a loop with increasing indexes does not produce a desired result.

Diff Detail

Event Timeline

olegshyshkov created this revision.Oct 27 2022, 3:38 AM
Herald added a project: Restricted Project. · View Herald Transcript
olegshyshkov requested review of this revision.Oct 27 2022, 3:38 AM
ftynse accepted this revision.Oct 27 2022, 3:42 AM
This revision is now accepted and ready to land.Oct 27 2022, 3:42 AM
akuegel accepted this revision.Oct 27 2022, 3:45 AM

Thanks for fixing this :)

mlir/include/mlir/IR/AffineMap.h
252

Personally I would pass std::greater<int>() instead of using rbegin()/rend()
I think this is easier readable.

Replace rbegin()/rend() with std::greater<int>().

olegshyshkov marked an inline comment as done.Oct 27 2022, 4:34 AM

Thank you!

mlir/include/mlir/IR/AffineMap.h
252

Fair point! And with llvm::sort it's even shorter.

This revision was landed with ongoing or failed builds.Oct 27 2022, 4:35 AM
This revision was automatically updated to reflect the committed changes.
olegshyshkov marked an inline comment as done.