This is an archive of the discontinued LLVM Phabricator instance.

[mlir][vector] Clean up use of `llvm::zip` in `VectorOps.cpp`
ClosedPublic

Authored by kuhar on Nov 30 2022, 8:57 AM.

Details

Summary
  • Use zip_equal where iteratees are supposted to have equal lenght.
  • Use zip_first where the first iteratee is supposed to be the shortest.
  • Use llvm::enumerate instead of calculating index manually.
  • Use structured bindings to unpack tuples where appropriate.
  • Fix a bug in a comparison in intersectsWhereNonNegative.

Both zip_first (after D138858) and zip_equal (introduced in D138865)
assert interatee lengths, which allows us to more precisely convey
whether we want to iterate over the common prefix (zip), or expect all
lengths to be the same (zip_equal).

Diff Detail

Event Timeline

kuhar created this revision.Nov 30 2022, 8:57 AM
Herald added a project: Restricted Project. · View Herald Transcript
kuhar requested review of this revision.Nov 30 2022, 8:57 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 30 2022, 8:57 AM
kuhar added a reviewer: kazu.Nov 30 2022, 8:58 AM
antiagainst accepted this revision.Nov 30 2022, 9:28 AM

Nice, thanks for the improvement!

This revision is now accepted and ready to land.Nov 30 2022, 9:28 AM
dcaballe accepted this revision.Nov 30 2022, 10:21 AM