summaryrefslogtreecommitdiff
path: root/lib/Support/BlockFrequency.cpp
Commit message (Collapse)AuthorAge
* blockfreq: Defer to BranchProbability::scale() (again)Duncan P. N. Exon Smith2014-04-29
| | | | | | | | | | | | Change `BlockFrequency` to defer to `BranchProbability::scale()` and `BranchProbability::scaleByInverse()`. This removes `BlockFrequency::scale()` from its API (and drops the ability to see the remainder), but the only user was the unit tests. If some code in the future needs an API that exposes the remainder, we can add something to `BranchProbability`, but I find that unlikely. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207550 91177308-0d34-0410-b5e6-96231b3b80d8
* [block-freq] Add a right shift to BlockFrequency that saturates at 1.Michael Gottesman2013-12-14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197302 91177308-0d34-0410-b5e6-96231b3b80d8
* [block-freq] Remove old BlockFrequency entry frequency and printing code.Michael Gottesman2013-12-14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197297 91177308-0d34-0410-b5e6-96231b3b80d8
* [block-freq] Add BlockFrequency::scale that returns a remainder from the ↵Michael Gottesman2013-11-17
| | | | | | | | | | | | | | | | | | | | | | | | | | division and make the private scale in BlockFrequency more performant. This change is the first in a series of changes improving LLVM's Block Frequency propogation implementation to not lose probability mass in branchy code when propogating block frequency information from a basic block to its successors. This patch is a simple infrastructure improvement that does not actually modify the block frequency algorithm. The specific changes are: 1. Changes the division algorithm used when scaling block frequencies by branch probabilities to a short division algorithm. This gives us the remainder for free as well as provides a nice speed boost. When I benched the old routine and the new routine on a Sandy Bridge iMac with disabled turbo mode performing 8192 iterations on an array of length 32768, I saw ~600% increase in speed in mean/median performance. 2. Exposes a scale method that returns a remainder. This is important so we can ensure that when we scale a block frequency by some branch probability BP = N/D, the remainder from the division by D can be retrieved and propagated to other children to ensure no probability mass is lost (more to come on this). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194950 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a bad overflow check pointed out by Ben.Jakob Stoklund Olesen2013-06-28
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185226 91177308-0d34-0410-b5e6-96231b3b80d8
* Eliminate an assortment of undefined behavior.Jakob Stoklund Olesen2013-06-28
| | | | | | Hopefully, this fixes the PPC64 buildbots. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185218 91177308-0d34-0410-b5e6-96231b3b80d8
* Stylistic cleanups, no functional change.Jakob Stoklund Olesen2013-06-28
| | | | | | | | - Use static functions instead of anonymous namespace. - Appease the Doxygen lobby. - Use 0-based induction variable. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185185 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a division operator to BlockFrequency.Jakob Stoklund Olesen2013-06-28
| | | | | | | | | | | Allow a BlockFrequency to be divided by a non-zero BranchProbability with saturating arithmetic. This will be used to compute the frequency of a loop header given the probability of leaving the loop. Our long division algorithm already saturates on overflow, so that was a freebie. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185184 91177308-0d34-0410-b5e6-96231b3b80d8
* Print block frequencies in decimal form.Jakob Stoklund Olesen2013-06-25
| | | | | | | | | This is easier to read than the internal fixed-point representation. If anybody knows the correct algorithm for converting fixed-point numbers to base 10, feel free to fix it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184881 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "BlockFrequency: Saturate at 1 instead of 0 when multiplying a ↵Benjamin Kramer2013-06-21
| | | | | | | | frequency with a branch probability." This reverts commit r184584. Breaks PPC selfhost. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184590 91177308-0d34-0410-b5e6-96231b3b80d8
* BlockFrequency: Saturate at 1 instead of 0 when multiplying a frequency with ↵Benjamin Kramer2013-06-21
| | | | | | | | | | | | | | | a branch probability. Zero is used by BlockFrequencyInfo as a special "don't know" value. It also causes a sink for frequencies as you can't ever get off a zero frequency with more multiplies. This recovers a 10% regression on MultiSource/Benchmarks/7zip. A zero frequency was propagated into an inner loop causing excessive spilling. PR16402. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184584 91177308-0d34-0410-b5e6-96231b3b80d8
* BlockFrequency: Use a smarter overflow check.Benjamin Kramer2011-10-27
| | | | | | This trades one 64 bit div for one 64 bit mul and some arithmetic. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143106 91177308-0d34-0410-b5e6-96231b3b80d8
* Optimize 96-bit division a little bit.Jakub Staszak2011-07-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136222 91177308-0d34-0410-b5e6-96231b3b80d8
* Move static methods to the anonymous namespace.Jakub Staszak2011-07-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136221 91177308-0d34-0410-b5e6-96231b3b80d8
* Add BlockFrequency class.Jakub Staszak2011-07-25
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135992 91177308-0d34-0410-b5e6-96231b3b80d8