This is an archive of the discontinued LLVM Phabricator instance.

[ADT/STLExtras.h] - Add llvm::is_sorted wrapper and update callers.
ClosedPublic

Authored by grimar on Apr 13 2020, 6:26 AM.

Details

Summary

It can be used to avoid passing the begin and the end of a range.
This makes the code shorter and it is consistent with another
wrappers we already have.

Diff Detail

Event Timeline

grimar created this revision.Apr 13 2020, 6:26 AM
grimar retitled this revision from [ADT/STLExtras.h] - Add llvm::is_sort wrapper and update callers. to [ADT/STLExtras.h] - Add llvm::is_sorted wrapper and update callers..Apr 13 2020, 6:27 AM
MaskRay accepted this revision.Apr 13 2020, 8:17 AM

Looks great! Hope another reviewer can confirm.

llvm/lib/IR/AsmWriter.cpp
231–233

This can be further simplified to llvm::is_sorted(lll, llvm::less_second())

llvm/lib/IR/Attributes.cpp
1022–1027

llvm::is_sorted(..., llvm::less_first())

This revision is now accepted and ready to land.Apr 13 2020, 8:17 AM
dblaikie accepted this revision.Apr 13 2020, 12:13 PM

Sounds good to me

grimar marked an inline comment as done.Apr 14 2020, 3:53 AM
grimar added inline comments.
llvm/lib/IR/AsmWriter.cpp
231–233

I was not aware of llvm::less_*(), thanks!

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptApr 14 2020, 4:14 AM
martong removed a subscriber: martong.Apr 15 2020, 9:13 AM