aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/StackColoring.cpp
diff options
context:
space:
mode:
authorUlrich Weigand <ulrich.weigand@de.ibm.com>2012-11-15 19:33:30 +0000
committerUlrich Weigand <ulrich.weigand@de.ibm.com>2012-11-15 19:33:30 +0000
commitf38aa4272c2fcebae4ad10b21ea29874d0edef80 (patch)
treeb70371cd4c225f360da82e894751005525ef78c6 /lib/CodeGen/StackColoring.cpp
parent7c6694946d2d2e45d529430b4678b553cd164f58 (diff)
Use std::stable_sort instead of std::sort when sorting stack slots
to guarantee deterministic code generation. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168074 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/StackColoring.cpp')
-rw-r--r--lib/CodeGen/StackColoring.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/CodeGen/StackColoring.cpp b/lib/CodeGen/StackColoring.cpp
index 1cbee843a1..e306a2f2c2 100644
--- a/lib/CodeGen/StackColoring.cpp
+++ b/lib/CodeGen/StackColoring.cpp
@@ -720,7 +720,9 @@ bool StackColoring::runOnMachineFunction(MachineFunction &Func) {
// 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) {