llvm-6502/test/Transforms
Diego Novillo 0de8cecb84 Propagation of profile samples through the CFG.
This adds a propagation heuristic to convert instruction samples
into branch weights. It implements a similar heuristic to the one
implemented by Dehao Chen on GCC.

The propagation proceeds in 3 phases:

1- Assignment of block weights. All the basic blocks in the function
   are initial assigned the same weight as their most frequently
   executed instruction.

2- Creation of equivalence classes. Since samples may be missing from
   blocks, we can fill in the gaps by setting the weights of all the
   blocks in the same equivalence class to the same weight. To compute
   the concept of equivalence, we use dominance and loop information.
   Two blocks B1 and B2 are in the same equivalence class if B1
   dominates B2, B2 post-dominates B1 and both are in the same loop.

3- Propagation of block weights into edges. This uses a simple
   propagation heuristic. The following rules are applied to every
   block B in the CFG:

   - If B has a single predecessor/successor, then the weight
     of that edge is the weight of the block.

   - If all the edges are known except one, and the weight of the
     block is already known, the weight of the unknown edge will
     be the weight of the block minus the sum of all the known
     edges. If the sum of all the known edges is larger than B's weight,
     we set the unknown edge weight to zero.

   - If there is a self-referential edge, and the weight of the block is
     known, the weight for that edge is set to the weight of the block
     minus the weight of the other incoming edges to that block (if
     known).

Since this propagation is not guaranteed to finalize for every CFG, we
only allow it to proceed for a limited number of iterations (controlled
by -sample-profile-max-propagate-iterations). It currently uses the same
GCC default of 100.

Before propagation starts, the pass builds (for each block) a list of
unique predecessors and successors. This is necessary to handle
identical edges in multiway branches. Since we visit all blocks and all
edges of the CFG, it is cleaner to build these lists once at the start
of the pass.

Finally, the patch fixes the computation of relative line locations.
The profiler emits lines relative to the function header. To discover
it, we traverse the compilation unit looking for the subprogram
corresponding to the function. The line number of that subprogram is the
line where the function begins. That becomes line zero for all the
relative locations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198972 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-10 23:23:46 +00:00
..
ADCE [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
ArgumentPromotion ArgumentPromotion: correctly transfer TBAA tags and alignments. 2013-11-15 20:41:15 +00:00
BBVectorize Prevent LoopVectorizer and SLPVectorizer running if the target has no vector registers. 2013-09-18 12:43:35 +00:00
BranchFolding
CodeExtractor [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
CodeGenPrepare [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
ConstantMerge Corruptly merge constants with explicit and implicit alignments. 2013-11-12 20:21:43 +00:00
ConstProp Teach ConstantFolding about pointer address spaces 2013-08-20 21:20:04 +00:00
CorrelatedValuePropagation [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
DeadArgElim Debug Info: update testing cases to specify the debug info version number. 2013-11-22 21:49:45 +00:00
DeadStoreElimination Debug Info: update testing cases to specify the debug info version number. 2013-11-22 21:49:45 +00:00
DebugIR Use right pointer type in DebugIR 2013-09-27 22:26:25 +00:00
EarlyCSE [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
FunctionAttrs [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
GCOVProfiling Debug Info: update testing cases to specify the debug info version number. 2013-11-22 21:49:45 +00:00
GlobalDCE [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
GlobalOpt Delete unread globals through addrspacecast 2014-01-02 20:01:43 +00:00
GVN Fix PR17952. 2013-11-11 22:00:23 +00:00
IndVarSimplify Reapply r198654 "indvars: sink truncates outside the loop." 2014-01-07 06:59:12 +00:00
Inline [inliner] Fix PR18206 by preventing inlining functions that call setjmp 2013-12-13 08:00:01 +00:00
InstCombine Fix a bug about generating undef operand when optimising shuffle vector and insert element in instruction combine. 2014-01-08 03:06:15 +00:00
InstSimplify Add a test that large offsets on GEPs on 32 bits targets are handled correctly. 2013-09-28 21:27:49 +00:00
Internalize Correct word hyphenations 2013-12-05 05:44:44 +00:00
IPConstantProp [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
JumpThreading Don't eliminate a partially redundant load if it's in a landing pad. 2013-10-21 04:09:17 +00:00
LCSSA [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
LICM Debug Info: update testing cases to specify the debug info version number. 2013-11-23 01:16:29 +00:00
LoopDeletion [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
LoopIdiom Debug Info: update testing cases to specify the debug info version number. 2013-11-23 01:16:29 +00:00
LoopReroll Fix loop rerolling pass failure with non-consant loop lower bound 2014-01-03 17:20:01 +00:00
LoopRotate Rename test with misspelt filename 2013-12-02 04:31:36 +00:00
LoopSimplify Reapply r198478 "Fix PR18361: Invalidate LoopDispositions after LoopSimplify hoists things." 2014-01-06 19:43:14 +00:00
LoopStrengthReduce Fix "existant" typos 2013-10-29 02:35:28 +00:00
LoopUnroll Implement TTI getUnrollingPreferences for PowerPC 2013-09-11 21:20:40 +00:00
LoopUnswitch [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
LoopVectorize LoopVectorizer: Handle strided memory accesses by versioning 2014-01-10 18:20:32 +00:00
LowerAtomic [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
LowerExpectIntrinsic [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
LowerInvoke [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
LowerSwitch Revert patches to add case-range support for PR1255. 2013-09-09 19:14:35 +00:00
Mem2Reg Debug Info: update testing cases to specify the debug info version number. 2013-11-22 21:49:45 +00:00
MemCpyOpt [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
MergeFunc PR17925 bugfix. 2013-11-26 16:11:03 +00:00
MetaRenamer [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
ObjCARC BasicAA: Use reachabilty instead of dominance for checking value equality in phi 2014-01-03 05:47:03 +00:00
PhaseOrdering [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
PruneEH [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
Reassociate [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
Reg2Mem [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
SampleProfile Propagation of profile samples through the CFG. 2014-01-10 23:23:46 +00:00
Scalarizer Fix Scalarizer insertion point when replacing PHIs with insertelements 2013-12-23 14:51:56 +00:00
ScalarRepl Debug Info: update testing cases to specify the debug info version number. 2013-11-22 21:49:45 +00:00
SCCP [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
SimplifyCFG Transforms: Don't create bad weights when eliminating dead cases 2013-12-20 08:21:30 +00:00
Sink [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
SLPVectorizer SLPVectorizer: An in-tree vectorized entry cannot also be a scalar external use 2013-12-05 15:14:40 +00:00
SROA Fix an issue where SROA computed different results based on the relative 2013-11-19 09:03:18 +00:00
StripSymbols Debug Info: update testing cases to specify the debug info version number. 2013-11-22 21:49:45 +00:00
StructurizeCFG StructurizeCFG: Fix verification failure with some loops. 2013-11-22 19:24:39 +00:00
TailCallElim [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00
TailDup [tests] Cleanup initialization of test suffixes. 2013-08-16 00:37:11 +00:00