[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:34:40 PDT 2017


> On Oct 24, 2017, at 1:27 PM, Grang, Mandeep Singh <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.
> 
> 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.

I see. It looks like the iteration order over FunctionInstantiationSetCollector is undefined, so we'd need to fix that as well. I'll CC you on a patch.

That said, I think r316490 is still needed. The comparison operator for sub-views just looks at line numbers: given two sub-views with the same line number, llvm-cov should preserve the input order.

vedant


> 
> --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
>> 
>> 
>> 
> 



More information about the llvm-commits mailing list