[llvm-commits] [llvm] r168074 - /llvm/trunk/lib/CodeGen/StackColoring.cpp

Ulrich Weigand ulrich.weigand at de.ibm.com
Thu Nov 15 11:33:30 PST 2012


Author: uweigand
Date: Thu Nov 15 13:33:30 2012
New Revision: 168074

URL: http://llvm.org/viewvc/llvm-project?rev=168074&view=rev
Log:
Use std::stable_sort instead of std::sort when sorting stack slots
to guarantee deterministic code generation.

Modified:
    llvm/trunk/lib/CodeGen/StackColoring.cpp

Modified: llvm/trunk/lib/CodeGen/StackColoring.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StackColoring.cpp?rev=168074&r1=168073&r2=168074&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/StackColoring.cpp (original)
+++ llvm/trunk/lib/CodeGen/StackColoring.cpp Thu Nov 15 13:33:30 2012
@@ -720,7 +720,9 @@
   // and continue.
 
   // Sort the slots according to their size. Place unused slots at the end.
-  std::sort(SortedSlots.begin(), SortedSlots.end(), SlotSizeSorter(MFI));
+  // Use stable sort to guarantee deterministic code generation.
+  std::stable_sort(SortedSlots.begin(), SortedSlots.end(),
+                   SlotSizeSorter(MFI));
 
   bool Chanded = true;
   while (Chanded) {





More information about the llvm-commits mailing list