[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
Thu Nov 9 10:05:38 PST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL317817: [GlobalMerge] Stable sort GlobalSets to fix non-deterministic sort order (authored by mgrang).

Changed prior to commit:
  https://reviews.llvm.org/D39635?vs=121613&id=122263#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D39635

Files:
  llvm/trunk/lib/CodeGen/GlobalMerge.cpp


Index: llvm/trunk/lib/CodeGen/GlobalMerge.cpp
===================================================================
--- llvm/trunk/lib/CodeGen/GlobalMerge.cpp
+++ llvm/trunk/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.122263.patch
Type: text/x-patch
Size: 638 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171109/c737c3d4/attachment.bin>


More information about the llvm-commits mailing list