llvm-6502/include/llvm/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
..
AliasAnalysis.h Fix extra whitespace in comment. 2011-10-15 19:36:45 +00:00
AliasSetTracker.h Fix AliasSetTracker so that it doesn't make any assumptions about instructions it doesn't know about (like the atomic instructions I'm adding). 2011-07-27 00:46:46 +00:00
BlockFrequencyImpl.h Add BlockFrequency::getEntryFrequency() 2011-08-01 15:22:10 +00:00
BlockFrequencyInfo.h Add pass printing support to BlockFrequencyInfo pass. The implementation 2011-10-19 10:12:41 +00:00
BranchProbabilityInfo.h Remove return heuristics from the static branch probabilities, and 2011-10-24 12:01:08 +00:00
CallGraph.h Teach the CallGraph to ignore calls to intrinsics. 2011-06-09 19:46:27 +00:00
CaptureTracking.h 80-columns 2010-07-13 05:50:08 +00:00
CFGPrinter.h Don't include Operator.h from InstrTypes.h. 2011-04-11 09:35:34 +00:00
CodeMetrics.h Inlining and unrolling heuristics should be aware of free truncs. 2011-10-01 01:39:05 +00:00
ConstantFolding.h Add some simple insertvalue simplifications, for the purpose of cleaning 2011-09-05 06:52:48 +00:00
ConstantsScanner.h
DebugInfo.h Whitespace. 2011-10-18 22:50:13 +00:00
DIBuilder.h Add a new wrapper node for a DILexicalBlock that encapsulates it and a 2011-10-11 22:59:11 +00:00
DominanceFrontier.h There is no point in verifying an analysis that is never updated. 2011-01-18 05:44:04 +00:00
DominatorInternals.h Convert a std::vector to a SmallVector for another 5.4% speedup on domtree. 2011-01-23 06:54:22 +00:00
Dominators.h In the simpler version of the link-eval data structure that we use in dominator 2011-01-23 06:16:06 +00:00
DomPrinter.h add function passes for printing various dominator datastructures 2009-10-18 04:10:40 +00:00
DOTGraphTraitsPass.h Remove WriteGraph's Name argument, which it didn't use, and 2010-09-27 15:34:19 +00:00
FindUsedTypes.h land David Blaikie's patch to de-constify Type, with a few tweaks. 2011-07-18 04:54:35 +00:00
InlineCost.h Inlining and unrolling heuristics should be aware of free truncs. 2011-10-01 01:39:05 +00:00
InstructionSimplify.h Add some simple insertvalue simplifications, for the purpose of cleaning 2011-09-05 06:52:48 +00:00
Interval.h
IntervalIterator.h Use std::vector rather than SmallVector here because SmallVector 2010-07-08 13:06:08 +00:00
IntervalPartition.h Get rid of static constructors for pass registration. Instead, every pass exposes an initializeMyPassFunction(), which 2010-10-19 17:21:58 +00:00
IVUsers.h Added a SimplifyIndVar utility to simplify induction variable users 2011-08-10 03:46:27 +00:00
LazyValueInfo.h Get rid of static constructors for pass registration. Instead, every pass exposes an initializeMyPassFunction(), which 2010-10-19 17:21:58 +00:00
LibCallAliasAnalysis.h Get rid of static constructors for pass registration. Instead, every pass exposes an initializeMyPassFunction(), which 2010-10-19 17:21:58 +00:00
LibCallSemantics.h Remove the experimental AliasAnalysis::getDependency interface, which 2010-09-14 21:25:10 +00:00
Lint.h Remove unused STL header includes. 2011-04-23 19:53:52 +00:00
Loads.h Move FindAvailableLoadedValue isSafeToLoadUnconditionally out of 2010-05-28 16:19:17 +00:00
LoopDependenceAnalysis.h Get rid of static constructors for pass registration. Instead, every pass exposes an initializeMyPassFunction(), which 2010-10-19 17:21:58 +00:00
LoopInfo.h LoopInfo::updateUnloop fix, and verify Block->Loop maps. 2011-08-26 03:06:34 +00:00
LoopIterator.h Cleanup. Remove an extraneous GraphTraits specialization. 2011-08-10 22:55:39 +00:00
LoopPass.h Reapply r138695. Fix PassManager stack depths. 2011-08-29 17:07:00 +00:00
MemoryBuiltins.h land David Blaikie's patch to de-constify Type, with a few tweaks. 2011-07-18 04:54:35 +00:00
MemoryDependenceAnalysis.h Enhance the memdep interface so that users can tell the difference between a dependency which cannot be calculated and a path reaching the entry point of the function. This patch introduces isNonFuncLocal, which replaces isUnknown in some cases. 2011-10-13 22:14:57 +00:00
Passes.h The ARC language-specific optimizer. Credit to Dan Gohman. 2011-06-15 23:37:01 +00:00
PathNumbering.h Implementation of path profiling. 2011-01-29 01:09:53 +00:00
PathProfileInfo.h Remove unused STL header includes. 2011-04-23 19:53:52 +00:00
PHITransAddr.h Reapply r97010, the speculative revert failed. 2010-02-24 08:48:04 +00:00
PostDominators.h remove postdom frontiers, because it is dead. Forward dom frontiers are 2011-04-05 21:57:17 +00:00
ProfileInfo.h Convert debug messages to use dbgs(). Generally this means 2009-12-23 17:55:11 +00:00
ProfileInfoLoader.h
ProfileInfoTypes.h This is #included by .c files. Remove C++-style comments. 2011-01-29 21:54:26 +00:00
RegionInfo.h Fix a ton of comment typos found by codespell. Patch by 2011-04-15 05:18:47 +00:00
RegionIterator.h Fix a ton of comment typos found by codespell. Patch by 2011-04-15 05:18:47 +00:00
RegionPass.h Reapply r138695. Fix PassManager stack depths. 2011-08-29 17:07:00 +00:00
RegionPrinter.h Add new RegionInfo pass. 2010-07-22 07:46:31 +00:00
ScalarEvolution.h The product of two chrec's can always be represented as a chrec. 2011-10-04 06:51:26 +00:00
ScalarEvolutionExpander.h Fix SCEVExpander assert during LSR: "argument of incompatible type". 2011-10-15 06:19:55 +00:00
ScalarEvolutionExpressions.h land David Blaikie's patch to de-constify Type, with a few tweaks. 2011-07-18 04:54:35 +00:00
ScalarEvolutionNormalization.h Generalize IVUsers to track arbitrary expressions rather than expressions 2010-04-07 22:27:08 +00:00
SparsePropagation.h Eliminate unnecessary LLVMContexts. 2009-12-18 23:42:08 +00:00
Trace.h
ValueTracking.h Convert InsertValueInst and ExtractValueInst APIs to use ArrayRef. 2011-07-13 10:26:04 +00:00
Verifier.h Fix a comment. 2010-04-08 17:41:04 +00:00