[hot-cold-split] fix static analysis of cold regions
authorSebastian Pop <sebpop@gmail.com>
Mon, 15 Oct 2018 21:43:11 +0000 (21:43 +0000)
committerSebastian Pop <sebpop@gmail.com>
Mon, 15 Oct 2018 21:43:11 +0000 (21:43 +0000)
commit542e522b87bee4aae543da3a81259acac8790e1b
tree315e3baff49e5a145d27ceacf03af450dc8a7b3b
parent212e23d01508e7b55f81ed7e64c02036ef22b981
[hot-cold-split] fix static analysis of cold regions

Make the code of blockEndsInUnreachable to match the function
blockEndsInUnreachable in CodeGen/BranchFolding.cpp. I also have
added a note to make sure the code of this function will not be
modified unless the back-end version is also modified.

An early return before outlining has been added to avoid
outlining the full function body when the first block in the
function is marked cold.

The static analysis of cold code has been amended to avoid
marking the whole function as cold by back-propagation
because the back-propagation would mark blocks with return
statements as cold.

The patch adds debug statements to help discover these problems.

Differential Revision: https://reviews.llvm.org/D52904

llvm-svn: 344558
llvm/lib/Transforms/IPO/HotColdSplitting.cpp
llvm/test/Transforms/HotColdSplit/split-cold-1.ll
llvm/test/Transforms/HotColdSplit/split-cold-2.ll