[PATCH] D39245: [ADT] Shuffle containers before sorting to uncover non-deterministic behavior

Vedant Kumar via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 24 13:43:03 PDT 2017


> On Oct 24, 2017, at 1:37 PM, David Blaikie <dblaikie at gmail.com> wrote:
> 
> 
> 
> On Tue, Oct 24, 2017 at 1:27 PM Grang, Mandeep Singh <mgrang at codeaurora.org <mailto:mgrang at codeaurora.org>> wrote:
> Vedant,
> 
> I am not sure if stable_sort is the correct solution in r316490. Try
> calling std::random_shuffle before you do std::stable_sort for
> InstantiationSubViews in SourceCoverageView.cpp and you will still see
> the two llvm-cov tests failing.
> 
> random_shuffle+stable_sort doesn't seem like a test that's necessary to pass, unless I'm missing something.
> 

> stable_sort would be used somewhere where the input order is already well defined (so shuffling it wouldn't simulate expected program behavior).

Right, I don't think the stable_sort could be expected to preserve the input order after the container has been shuffled.

vedant

>  
> 
> I guess the problem is that InstantiationSubViews is filled from an
> unordered container and the input order itself is undefined. So
> stable_sort won't help in this case.
> 
> --Mandeep
> 
> 
> On 10/24/2017 1:04 PM, Vedant Kumar via Phabricator wrote:
> > vsk added a comment.
> >
> > @mgrang thanks, should be fixed in r316490.
> >
> >
> > Repository:
> >    rL LLVM
> >
> > https://reviews.llvm.org/D39245 <https://reviews.llvm.org/D39245>
> >
> >
> >
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171024/9c365b8e/attachment.html>


More information about the llvm-commits mailing list