aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMandeep Singh Grang <mgrang@codeaurora.org>2017-11-09 18:05:17 +0000
committerMandeep Singh Grang <mgrang@codeaurora.org>2017-11-09 18:05:17 +0000
commitd28baf618325d42f1615186394dd5b0a183235d6 (patch)
tree6b3c0247b3bb98723644bacf37a202a7b8032403
parent06f6588caf083420e68044040ae6d46767464fb2 (diff)
[GlobalMerge] Stable sort GlobalSets to fix non-deterministic sort order
Summary: This fixes failure in CodeGen/AArch64/global-merge-group-by-use.ll uncovered by D39245. Reviewers: ab, asl Reviewed By: ab Subscribers: aemerson, llvm-commits, kristof.beyls Differential Revision: https://reviews.llvm.org/D39635 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317817 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/GlobalMerge.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/CodeGen/GlobalMerge.cpp b/lib/CodeGen/GlobalMerge.cpp
index 52a5737a525..325453180d5 100644
--- a/lib/CodeGen/GlobalMerge.cpp
+++ b/lib/CodeGen/GlobalMerge.cpp
@@ -386,7 +386,7 @@ bool GlobalMerge::doMerge(SmallVectorImpl<GlobalVariable*> &Globals,
//
// Multiply that by the size of the set to give us a crude profitability
// metric.
- std::sort(UsedGlobalSets.begin(), UsedGlobalSets.end(),
+ std::stable_sort(UsedGlobalSets.begin(), UsedGlobalSets.end(),
[](const UsedGlobalSet &UGS1, const UsedGlobalSet &UGS2) {
return UGS1.Globals.count() * UGS1.UsageCount <
UGS2.Globals.count() * UGS2.UsageCount;