Tweak the loop rotation logic to check whether the loop is naturally
authorChandler Carruth <chandlerc@gmail.com>
Mon, 16 Apr 2012 09:31:23 +0000 (09:31 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Mon, 16 Apr 2012 09:31:23 +0000 (09:31 +0000)
commit16295fc20b68f9a9318cada4e4d96e964b1cdd7e
tree56ca18ae1e43f574477b2fbd936310e1b91f15b3
parent246de858e37a989a9cdf9b80d7434453b2c52e70
Tweak the loop rotation logic to check whether the loop is naturally
laid out in a form with a fallthrough into the header and a fallthrough
out of the bottom. In that case, leave the loop alone because any
rotation will introduce unnecessary branches. If either side looks like
it will require an explicit branch, then the rotation won't add any, do
it to ensure the branch occurs outside of the loop (if possible) and
maximize the benefit of the fallthrough in the bottom.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154806 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/MachineBlockPlacement.cpp
test/CodeGen/X86/block-placement.ll