llvm-6502/include/llvm
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
..
ADT Avoid warnings about the parameter G being unused. 2011-10-20 08:56:41 +00:00
Analysis Remove return heuristics from the static branch probabilities, and 2011-10-24 12:01:08 +00:00
Assembly
Bitcode Initial commit of the 'landingpad' instruction. 2011-08-12 20:24:12 +00:00
CodeGen Implement a block placement pass based on the branch probability and 2011-10-21 06:46:38 +00:00
Config We're no longer going to bother supporting platforms that don't 2011-09-23 00:53:10 +00:00
DebugInfo DebugInfo: Add equality operators and default constructor to DILineInfo. 2011-09-21 01:13:16 +00:00
ExecutionEngine Tidy up. Formatting. 2011-09-29 21:43:01 +00:00
MC Add support for a new extension to the .file directive: 2011-10-17 23:05:28 +00:00
Object Object/COFF: Change type from a struct to a uint16_t. The struct would be 2011-10-18 19:31:59 +00:00
Support Now that we have comparison on probabilities, add some static functions 2011-10-23 20:10:34 +00:00
TableGen Add NAME Member 2011-10-19 13:04:13 +00:00
Target Haven't yet found a nice way to handle TargetData verification in the 2011-10-20 19:24:44 +00:00
Transforms svn mv Target/ARM/ARMGlobalMerge.cpp Transforms/Scalar/GlobalMerge.cpp 2011-10-17 17:17:43 +00:00
Argument.h
Attributes.h Add the returns_twice attribute to LLVM. 2011-10-03 14:45:37 +00:00
AutoUpgrade.h Initial check in that will auto-upgrade the old EH scheme to the new EH scheme. 2011-08-25 23:22:40 +00:00
BasicBlock.h Remove useless code. 2011-10-20 04:33:44 +00:00
CallGraphSCCPass.h
CallingConv.h
CMakeLists.txt Build system infrastructure for multiple tblgens. 2011-10-06 01:51:51 +00:00
Constant.h Implement Constant::isAllOnesValue(). Fix ConstantFolding to use the new api. 2011-08-24 20:18:38 +00:00
Constants.h Constify Comparison 2011-08-25 20:18:22 +00:00
DebugInfoProbe.h
DefaultPasses.h
DerivedTypes.h Rip out the old StructType APIs as warned about on llvmdev last week. 2011-08-18 17:39:28 +00:00
Function.h 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
GlobalAlias.h Remove DEFINE_TRANSPARENT_CASTED_OPERAND_ACCESSORS, folding its 2011-08-22 09:37:03 +00:00
GlobalValue.h
GlobalVariable.h
GVMaterializer.h
InitializePasses.h Implement a block placement pass based on the branch probability and 2011-10-21 06:46:38 +00:00
InlineAsm.h Encode register class constreaints in inline asm instructions. 2011-10-12 23:37:29 +00:00
InstrTypes.h
Instruction.def Initial commit of the 'landingpad' instruction. 2011-08-12 20:24:12 +00:00
Instruction.h
Instructions.h Add a routine to swap branch instruction operands, and update any 2011-10-17 01:11:57 +00:00
IntrinsicInst.h
Intrinsics.h
Intrinsics.td Mark the llvm.eh.sjlj.functioncontext intrinsic as reading memory so that fast 2011-10-10 17:08:47 +00:00
IntrinsicsAlpha.td
IntrinsicsARM.td
IntrinsicsCellSPU.td
IntrinsicsPowerPC.td
IntrinsicsPTX.td
IntrinsicsX86.td Remove intrinsics for X86 BLSI, BLSMSK, and BLSR intrinsics and replace with custom isel lowering code. 2011-10-21 06:55:01 +00:00
IntrinsicsXCore.td Update IntrinsicsXCore.td with the normal LLVM notice at the top of the file. 2011-10-13 21:08:11 +00:00
LinkAllPasses.h Remove the old tail duplication pass. It is not used and is unable to update 2011-08-30 23:03:45 +00:00
LinkAllVMCore.h
Linker.h Make it possible to use the linker without destroying the source module. This is so the source module can be linked to multiple other destination modules. For all that used LinkModules() before, they will continue to destroy the source module as before. 2011-10-11 00:24:54 +00:00
LLVMContext.h
Metadata.h
Module.h Remove the last improper use of getGlobalContext() from LLVM. 2011-08-13 01:04:44 +00:00
OperandTraits.h Remove DEFINE_TRANSPARENT_CASTED_OPERAND_ACCESSORS, folding its 2011-08-22 09:37:03 +00:00
Operator.h
Pass.h
PassAnalysisSupport.h
PassManager.h
PassManagers.h Reapply r138695. Fix PassManager stack depths. 2011-08-29 17:07:00 +00:00
PassRegistry.h
PassSupport.h
SymbolTableListTraits.h
Type.h
Use.h
User.h
Value.h Typo. 2011-08-11 00:22:48 +00:00
ValueSymbolTable.h