Teach machine block placement to cope with unnatural loops. These don't
authorChandler Carruth <chandlerc@gmail.com>
Mon, 14 Nov 2011 00:00:35 +0000 (00:00 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Mon, 14 Nov 2011 00:00:35 +0000 (00:00 +0000)
commitb5856c83ff4fd796c3eabccca2ed3b06173aeb51
tree7812a1e4c458d3b3c2918435cb7b1f2b1f6c9cdd
parent6c9cc21d85cdef79b971f710ace287f3a2f847a3
Teach machine block placement to cope with unnatural loops. These don't
get loop info structures associated with them, and so we need some way
to make forward progress selecting and placing basic blocks. The
technique used here is pretty brutal -- it just scans the list of blocks
looking for the first unplaced candidate. It keeps placing blocks like
this until the CFG becomes tractable.

The cost is somewhat unfortunate, it requires allocating a vector of all
basic block pointers eagerly. I have some ideas about how to simplify
and optimize this, but I'm trying to get the logic correct first.

Thanks to Benjamin Kramer for the reduced test case out of GCC. Sadly
there are other bugs that GCC is tickling that I'm reducing and working
on now.

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