llvm/test/Analysis
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
..
BasicAA PR10628: Fix getModRefInfo so it queries the underlying alias() implementation correctly while checking nocapture calls. 2011-09-28 00:34:27 +00:00
BlockFrequencyInfo Generalize the reading of probability metadata to work for both branches 2011-10-19 10:32:19 +00:00
BranchProbabilityInfo Remove return heuristics from the static branch probabilities, and 2011-10-24 12:01:08 +00:00
CallGraph Test case for r132797. 2011-06-14 03:02:05 +00:00
Dominators Eliminate more redundant llvm-as calls. 2009-09-11 18:17:12 +00:00
GlobalsModRef manually upgrade a bunch of tests to modern syntax, and remove some that 2011-06-17 03:14:27 +00:00
LoopDependenceAnalysis Make BasicAliasAnalysis a normal AliasAnalysis implementation which 2010-10-18 18:04:47 +00:00
LoopInfo Update these tests to match what Loop::print now prints. 2009-10-24 23:52:07 +00:00
PostDominators remove postdom frontiers, because it is dead. Forward dom frontiers are 2011-04-05 21:57:17 +00:00
Profiling test: Check the feature 'loadable_module' with load modules in %llvmshlibdir. 2010-11-29 07:58:32 +00:00
RegionInfo Make tests more useful. 2011-04-25 10:12:01 +00:00
ScalarEvolution Reapply r142781 with fix. Original message: 2011-10-24 06:57:05 +00:00
TypeBasedAliasAnalysis Reapply r131781, now that the GVN bug with partially-aliasing loads 2011-06-04 06:50:18 +00:00