llvm-6502/lib
Chandler Carruth de1c9bb450 Remove return heuristics from the static branch probabilities, and
introduce no-return or unreachable heuristics.

The return heuristics from the Ball and Larus paper don't work well in
practice as they pessimize early return paths. The only good hitrate
return heuristics are those for:
 - NULL return
 - Constant return
 - negative integer return

Only the last of these three can possibly require significant code for
the returning block, and even the last is fairly rare and usually also
a constant. As a consequence, even for the cold return paths, there is
little code on that return path, and so little code density to be gained
by sinking it. The places where sinking these blocks is valuable (inner
loops) will already be weighted appropriately as the edge is a loop-exit
branch.

All of this aside, early returns are nearly as common as all three of
these return categories, and should actually be predicted as taken!
Rather than muddy the waters of the static predictions, just remain
silent on returns and let the CFG itself dictate any layout or other
issues.

However, the return heuristic was flagging one very important case:
unreachable. Unfortunately it still gave a 1/4 chance of the
branch-to-unreachable occuring. It also didn't do a rigorous job of
finding those blocks which post-dominate an unreachable block.

This patch builds a more powerful analysis that should flag all branches
to blocks known to then reach unreachable. It also has better worst-case
runtime complexity by not looping through successors for each block. The
previous code would perform an N^2 walk in the event of a single entry
block branching to N successors with a switch where each successor falls
through to the next and they finally fall through to a return.

Test case added for noreturn heuristics. Also doxygen comments improved
along the way.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142793 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-24 12:01:08 +00:00
..
Analysis Remove return heuristics from the static branch probabilities, and 2011-10-24 12:01:08 +00:00
Archive Rewrite the CMake build to use explicit dependencies between libraries, 2011-07-29 00:14:25 +00:00
AsmParser Backing out patch. Will refactor to remove the AsmParser dependency on Target. 2011-10-18 00:23:49 +00:00
Bitcode Also update the EH with bitcode. I missed this earlier. Thanks to Duncan for pointing it out. 2011-10-05 07:04:14 +00:00
CodeGen Now that we have comparison on probabilities, add some static functions 2011-10-23 20:10:34 +00:00
DebugInfo lib/DebugInfo/DWARFDebugLine.cpp: De-Unicode-ify. 2011-10-08 11:22:47 +00:00
ExecutionEngine Adding dependencies to allow -DBUILD_SHARED_LIBS=true to complete. 2011-10-19 00:13:13 +00:00
Linker Allow the source module to be materialized during the linking process. 2011-10-14 22:17:46 +00:00
MC Fix parsing of a line with only a # in it. 2011-10-19 18:48:52 +00:00
Object Use LLVMBool for a function that logically returns a boolean value. 2011-10-21 20:35:58 +00:00
Support Windows/Path.inc: [PR8460] Get rid of ScopedNullTerminator. Thanks to Zvi Rackover! 2011-10-24 03:27:19 +00:00
TableGen Implement Paste 2011-10-19 13:04:43 +00:00
Target Add X86 SARX, SHRX, and SHLX instructions. 2011-10-23 22:18:24 +00:00
Transforms A dead malloc, a free(NULL) and a free(undef) are all trivially dead 2011-10-24 04:35:36 +00:00
VMCore Refactor code from inlining and globalopt that checks whether a function definition is unused, and enhance it so it can tell that functions which are only used by a blockaddress are in fact dead. This probably doesn't happen much on most code, but the Linux kernel's _THIS_IP_ can trigger this issue with blockaddress. (GlobalDCE can also handle the given tescase, but we only run that at -O3.) Found while looking at PR11180. 2011-10-20 05:23:42 +00:00
CMakeLists.txt Move TableGen's parser and entry point into a library 2011-10-01 16:41:13 +00:00
Makefile Remove more of llvmc and dependencies. 2011-09-20 00:34:27 +00:00