[llvm] r329915 - [Pipeliner] Use std::stable_sort when ordering NodeSets
Krzysztof Parzyszek via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 12 08:11:12 PDT 2018
Author: kparzysz
Date: Thu Apr 12 08:11:11 2018
New Revision: 329915
URL: http://llvm.org/viewvc/llvm-project?rev=329915&view=rev
Log:
[Pipeliner] Use std::stable_sort when ordering NodeSets
There are cases when individual NodeSets can be equal with respect to
the ordering criteria. Since they are stored in an ordered container,
use stable_sort to preserve the relative order of equal NodeSets.
This should remove non-determinism discovered by shuffling done in
llvm::sort with expensive checks enabled.
Modified:
llvm/trunk/lib/CodeGen/MachinePipeliner.cpp
Modified: llvm/trunk/lib/CodeGen/MachinePipeliner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachinePipeliner.cpp?rev=329915&r1=329914&r2=329915&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachinePipeliner.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachinePipeliner.cpp Thu Apr 12 08:11:11 2018
@@ -931,7 +931,7 @@ void SwingSchedulerDAG::schedule() {
}
});
- llvm::sort(NodeSets.begin(), NodeSets.end(), std::greater<NodeSet>());
+ std::stable_sort(NodeSets.begin(), NodeSets.end(), std::greater<NodeSet>());
groupRemainingNodes(NodeSets);
More information about the llvm-commits
mailing list