Add tie breaker to colorChainSet() sort so that processing order doesn't
depend on std::set order, which depends on pointer order, which is
unstable from run to run.
No, I don’t think just switching to std::stable_sort() would solve the problem. The elements that are “equal” based on the sort comparison would remain in their original order before the sort, which I believe is determined by the order they occur in the EquivalenceClasses member iterator, which is in turn determined by pointer order since the EquivalenceClasses members are stored in a set<Chain*> in this case.
Hopefully that makes sense. If so, could you commit this change?
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
From: James Molloy [mailto:email@example.com]
Sent: Friday, January 30, 2015 3:41 AM
To: reviews+D7265firstname.lastname@example.org; email@example.com; firstname.lastname@example.org; email@example.com; firstname.lastname@example.org
Cc: email@example.com; firstname.lastname@example.org
Subject: Re: [PATCH] AArch64: Make AArch64A57FPLoadBalancing output stable.
Thanks for fixing this! It looks ok as-is, but wouldn't switching simply from std::sort to std::stable_sort solve the problem easier? Stable_sort is used for this reason in other areas of the compiler.
Adding Rafael to the review, since he had fixed similar issues in the past (r196520) relating to non-deterministic behavior.
Rafael, do you think this is a good fix to the non-deterministic behavior we are seeing?