[PATCH] D39635: [GlobalMerge] Stable sort GlobalSets to fix non-deterministic sort order
Mandeep Singh Grang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Nov 4 20:33:14 PDT 2017
mgrang created this revision.
Herald added subscribers: kristof.beyls, aemerson.
This fixes failure in CodeGen/AArch64/global-merge-group-by-use.ll uncovered by https://reviews.llvm.org/D39245.
Repository:
rL LLVM
https://reviews.llvm.org/D39635
Files:
lib/CodeGen/GlobalMerge.cpp
Index: lib/CodeGen/GlobalMerge.cpp
===================================================================
--- lib/CodeGen/GlobalMerge.cpp
+++ lib/CodeGen/GlobalMerge.cpp
@@ -386,7 +386,7 @@
//
// 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;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39635.121613.patch
Type: text/x-patch
Size: 605 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171105/a56f5d96/attachment.bin>
More information about the llvm-commits
mailing list