From b9e9c559111b72c3141b7bfdd6abb381aebe4ffc Mon Sep 17 00:00:00 2001 From: Manman Ren Date: Tue, 31 Jul 2012 20:45:38 +0000 Subject: [PATCH] MachineSink: Sort the successors before trying to find SuccToSinkTo. Use stable_sort instead of sort. Follow-up to r161062. rdar://11980766 llvm-svn: 161075 --- lib/CodeGen/MachineSink.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/CodeGen/MachineSink.cpp b/lib/CodeGen/MachineSink.cpp index d02aa6fe601..bc383cba455 100644 --- a/lib/CodeGen/MachineSink.cpp +++ b/lib/CodeGen/MachineSink.cpp @@ -538,7 +538,7 @@ MachineBasicBlock *MachineSinking::FindSuccToSinkTo(MachineInstr *MI, // we should sink to. // We give successors with smaller loop depth higher priority. SmallVector Succs(MBB->succ_begin(), MBB->succ_end()); - std::sort(Succs.begin(), Succs.end(), SuccessorSorter(LI)); + std::stable_sort(Succs.begin(), Succs.end(), SuccessorSorter(LI)); for (SmallVector::iterator SI = Succs.begin(), E = Succs.end(); SI != E; ++SI) { MachineBasicBlock *SuccBlock = *SI;