MachineSink: Sort the successors before trying to find SuccToSinkTo.
authorManman Ren <mren@apple.com>
Tue, 31 Jul 2012 18:10:39 +0000 (18:10 +0000)
committerManman Ren <mren@apple.com>
Tue, 31 Jul 2012 18:10:39 +0000 (18:10 +0000)
commit53b59d1d974184657edfd22779e0bb3653d164ec
treef49ed6abdb7377a97fa83fa6c9c9750e730cd817
parent8c574be2fec59a3d80e400a9a0409b28f7f34829
MachineSink: Sort the successors before trying to find SuccToSinkTo.

One motivating example is to sink an instruction from a basic block which has
two successors: one outside the loop, the other inside the loop. We should try
to sink the instruction outside the loop.

rdar://11980766

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161062 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/MachineSink.cpp
test/CodeGen/X86/sink-out-of-loop.ll [new file with mode: 0644]