summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/BranchProbabilityInfo.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Generalize the reading of probability metadata to work for both branchesChandler Carruth2011-10-191-16/+24
| | | | | | | | | and switches, with arbitrary numbers of successors. Still optimized for the common case of 2 successors for a conditional branch. Add a test case for switch metadata showing up in the BlockFrequencyInfo pass. llvm-svn: 142493
* Teach the BranchProbabilityInfo analysis pass to read any metadataChandler Carruth2011-10-191-0/+38
| | | | | | | | | | | encoding of probabilities. In the absense of metadata, it continues to fall back on static heuristics. This allows __builtin_expect, after lowering through llvm.expect a branch instruction's metadata, to actually enter the branch probability model. This is one component of resolving PR2577. llvm-svn: 142492
* Delete a dead member. Dunno if this was ever used, but the current codeChandler Carruth2011-10-161-6/+3
| | | | | | | directly manipulates the weights inside of the BranchProbabilityInfo that is passed in. llvm-svn: 142163
* Use canonical forms for the branch probability zero heutistic.Benjamin Kramer2011-09-041-25/+30
| | | | | | | | - Drop support for X >u 0, it's equivalent to X != 0 and should be canonicalized into the latter. - Add X < 1 -> unlikely, which is what instcombine canonicalizes X <= 0 into. - Add X > -1 -> likely, which is what instcombine canonicalizes X >= 0 into. llvm-svn: 139110
* Change SmallVector to SmallPtrSet in BranchProbabilityInfo. Handle cases whereJakub Staszak2011-08-011-15/+15
| | | | | | one than one successor goes to the same block. llvm-svn: 136638
* Do not handle cases with >= and <= predicates.Jakub Staszak2011-07-311-7/+0
| | | | llvm-svn: 136588
* Remove untrue comment.Jakub Staszak2011-07-311-3/+0
| | | | llvm-svn: 136587
* Do not handle case where LHS is equal to zero, because InstCombiner always movesJakub Staszak2011-07-311-24/+8
| | | | | | it to RHS anyway. llvm-svn: 136586
* Add Zero Heurestics to BranchProbabilityInfo. If we compare value to zero weJakub Staszak2011-07-311-1/+91
| | | | | | | | | | | | | decide whether condition is likely to be true this way: x == 0 -> false x < 0 -> false x <= 0 -> false x != 0 -> true x > 0 -> true x >= 0 -> true llvm-svn: 136583
* Add more constantness in BranchProbabilityInfo.Jakub Staszak2011-07-291-10/+11
| | | | llvm-svn: 136502
* Remove incEdgeWeight and decEdgeWeight. Set edge weight directly to avoidJakub Staszak2011-07-291-30/+35
| | | | | | rounding errors. llvm-svn: 136456
* Change LBH_TAKEN_WEIGHT to 124 (from 128). Right now, sum ofJakub Staszak2011-07-281-4/+4
| | | | | | | LBH_TAKEN_WEIGHT + LBH_NONTAKEN_WEIGHT = 128 which in _most_ cases reduce number of rounding errors. llvm-svn: 136428
* Heuristics are in descending priority now. If we use one of them, skip the rest.Jakub Staszak2011-07-281-13/+23
| | | | llvm-svn: 136402
* Add InEdges (edges from header to the loop) in Loop Branch Heuristics, soJakub Staszak2011-07-281-0/+17
| | | | | | | there is no frequency difference whether condition is in the header or in the latch. llvm-svn: 136398
* Remove "LoopInfo.h" include from BranchProbabilityInfo.h.Jakub Staszak2011-07-161-0/+5
| | | | llvm-svn: 135353
* Fix pointer heuristic. Check whether predicator is ICMP_NE instead of if it isJakub Staszak2011-07-151-2/+2
| | | | | | not isEquality(). llvm-svn: 135296
* Calculate backedge probability correctly.Jakub Staszak2011-06-231-24/+0
| | | | llvm-svn: 133776
* Introduce BlockFrequency analysis for BasicBlocks.Jakub Staszak2011-06-231-0/+24
| | | | llvm-svn: 133766
* Introduce MachineBranchProbabilityInfo class, which has similar API toJakub Staszak2011-06-161-1/+1
| | | | | | | | BranchProbabilityInfo (expect setEdgeWeight which is not available here). Branch Weights are kept in MachineBasicBlocks. To turn off this analysis set -use-mbpi=false. llvm-svn: 133184
* Move class into an anonymous namespace.Benjamin Kramer2011-06-131-1/+2
| | | | llvm-svn: 132925
* Branch profiling: floating-point avoidance.Andrew Trick2011-06-111-54/+63
| | | | | | | | | Patch by: Jakub Staszak! Introduces BranchProbability. Changes unsigned to uint32_t all over and uint64_t only when overflow is expected. llvm-svn: 132867
* Fold assert-only-used variable into the assert.Nick Lewycky2011-06-041-2/+1
| | | | llvm-svn: 132620
* Missing include of climits in the new BranchProbability pass.Andrew Trick2011-06-041-0/+1
| | | | llvm-svn: 132616
* New BranchProbabilityInfo analysis. Patch by Jakub Staszak!Andrew Trick2011-06-041-0/+348
BranchProbabilityInfo provides an interface for IR passes to query the likelihood that control follows a CFG edge. This patch provides an initial implementation of static branch predication that will populate BranchProbabilityInfo for branches with no external profile information using very simple heuristics. It currently isn't hooked up to any external profile data, so static prediction does all the work. llvm-svn: 132613
OpenPOWER on IntegriCloud