From 6c2f868bbd489d06b1e22bd8d1ce1e234018dbe5 Mon Sep 17 00:00:00 2001 From: Krzysztof Parzyszek Date: Thu, 12 Apr 2018 15:11:11 +0000 Subject: [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. llvm-svn: 329915 --- llvm/lib/CodeGen/MachinePipeliner.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'llvm/lib/CodeGen/MachinePipeliner.cpp') diff --git a/llvm/lib/CodeGen/MachinePipeliner.cpp b/llvm/lib/CodeGen/MachinePipeliner.cpp index 061d971..56d998a 100644 --- a/llvm/lib/CodeGen/MachinePipeliner.cpp +++ b/llvm/lib/CodeGen/MachinePipeliner.cpp @@ -931,7 +931,7 @@ void SwingSchedulerDAG::schedule() { } }); - llvm::sort(NodeSets.begin(), NodeSets.end(), std::greater()); + std::stable_sort(NodeSets.begin(), NodeSets.end(), std::greater()); groupRemainingNodes(NodeSets); -- cgit v1.1