Reverse order of the two branches at end of a basic block if it is profitable.
authorManman Ren <mren@apple.com>
Tue, 31 Jul 2012 01:11:07 +0000 (01:11 +0000)
committerManman Ren <mren@apple.com>
Tue, 31 Jul 2012 01:11:07 +0000 (01:11 +0000)
commit11236143173d1aedeace570ac1133d3d5dfb268e
tree9abc085334d55ef613dcb80c9bc04e59751d37df
parent8b5704f9589f20cdfb28b3632cc396995e4d8c45
Reverse order of the two branches at end of a basic block if it is profitable.

We branch to the successor with higher edge weight first.
Convert from
     je    LBB4_8  --> to outer loop
     jmp   LBB4_14 --> to inner loop
to
     jne   LBB4_14
     jmp   LBB4_8

PR12750
rdar: 11393714

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161018 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/MachineBlockPlacement.cpp
test/CodeGen/X86/reverse_branches.ll [new file with mode: 0644]