[llvm] r317817 - [GlobalMerge] Stable sort GlobalSets to fix non-deterministic sort order
Mandeep Singh Grang via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 9 10:05:17 PST 2017
Author: mgrang
Date: Thu Nov 9 10:05:17 2017
New Revision: 317817
URL: http://llvm.org/viewvc/llvm-project?rev=317817&view=rev
Log:
[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
Modified:
llvm/trunk/lib/CodeGen/GlobalMerge.cpp
Modified: llvm/trunk/lib/CodeGen/GlobalMerge.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/GlobalMerge.cpp?rev=317817&r1=317816&r2=317817&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/GlobalMerge.cpp (original)
+++ llvm/trunk/lib/CodeGen/GlobalMerge.cpp Thu Nov 9 10:05:17 2017
@@ -386,7 +386,7 @@ bool GlobalMerge::doMerge(SmallVectorImp
//
// 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;
More information about the llvm-commits
mailing list