Use std::stable_sort instead of std::sort when sorting stack slots

to guarantee deterministic code generation.

llvm-svn: 168074
This commit is contained in:
Ulrich Weigand 2012-11-15 19:33:30 +00:00
parent 4921017afd
commit dcee8ce8ed
1 changed files with 3 additions and 1 deletions

View File

@ -720,7 +720,9 @@ bool StackColoring::runOnMachineFunction(MachineFunction &Func) {
// and continue. // and continue.
// Sort the slots according to their size. Place unused slots at the end. // 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; bool Chanded = true;
while (Chanded) { while (Chanded) {