llvm::sort - A new wrapper to std::sort

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

llvm::sort - A new wrapper to std::sort

Sam McCall via cfe-dev

r327219 added a new wrapper function called llvm::sort. If EXPENSIVE_CHECKS is enabled, llvm::sort will randomly shuffle the container before invoking std::sort. This will help uncover non-deterministic ordering of objects having the same key.

All occurrences of std::sort have been changed to llvm::sort in llvm/clang/polly repos.

Going forward please make sure to avoid use of std::sort and instead use llvm::sort. Maybe we should add a note on the usage of llvm::sort to the LLVM Coding Standards?

Thanks,
Mandeep


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: llvm::sort - A new wrapper to std::sort

Sam McCall via cfe-dev
On 13 April 2018 at 21:24, Grang, Mandeep Singh via cfe-dev
<[hidden email]> wrote:
> Going forward please make sure to avoid use of std::sort and instead use
> llvm::sort. Maybe we should add a note on the usage of llvm::sort to the
> LLVM Coding Standards?

Very definitely. I quite like the idea, but banning a standard library
function on this scale is a big step and needs to be justified.
Generally we try to move in the other direction.

Really, this announcement should have linked to the original discussion.

Cheers.

Tim.
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: llvm::sort - A new wrapper to std::sort

Sam McCall via cfe-dev
Thanks Tim. I will add a note about llvm::sort to the coding guidelines.

> Really, this announcement should have linked to the original discussion.
The bulk of the discussion is on the comments of the patch https://reviews.llvm.org/D39245.
And here is the email which details the failures uncovered by the patch http://lists.llvm.org/pipermail/llvm-dev/2017-October/118639.html

--Mandeep



On 4/13/2018 2:37 PM, Tim Northover wrote:

> On 13 April 2018 at 21:24, Grang, Mandeep Singh via cfe-dev
> <[hidden email]> wrote:
>> Going forward please make sure to avoid use of std::sort and instead use
>> llvm::sort. Maybe we should add a note on the usage of llvm::sort to the
>> LLVM Coding Standards?
> Very definitely. I quite like the idea, but banning a standard library
> function on this scale is a big step and needs to be justified.
> Generally we try to move in the other direction.
>
> Really, this announcement should have linked to the original discussion.
>
> Cheers.
>
> Tim.

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev