Fix a silly use-after-free issue. A much earlier version of this code
authorChandler Carruth <chandlerc@gmail.com>
Thu, 24 Nov 2011 11:23:15 +0000 (11:23 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Thu, 24 Nov 2011 11:23:15 +0000 (11:23 +0000)
commit4aae4f90071f64854ec771496bd164149b0a1352
treea79d236ff20fd5ee89e5e0081625f5780e9035af
parenta2deea1dcf8363f46bda8935283c5c701b5a278d
Fix a silly use-after-free issue. A much earlier version of this code
need lots of fanciness around retaining a reference to a Chain's slot in
the BlockToChain map, but that's all gone now. We can just go directly
to allocating the new chain (which will update the mapping for us) and
using it.

Somewhat gross mechanically generated test case replicates the issue
Duncan spotted when actually testing this out.

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