1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-18 18:42:46 +02:00
Commit Graph

19 Commits

Author SHA1 Message Date
Chandler Carruth
ae65e281f3 Update the file headers across all of the LLVM projects in the monorepo
to reflect the new license.

We understand that people may be surprised that we're moving the header
entirely to discuss the new license. We checked this carefully with the
Foundation's lawyer and we believe this is the correct approach.

Essentially, all code in the project is now made available by the LLVM
project under our new license, so you will see that the license headers
include that license only. Some of our contributors have contributed
code under our old license, and accordingly, we have retained a copy of
our old license notice in the top-level files in each project and
repository.

llvm-svn: 351636
2019-01-19 08:50:56 +00:00
Cong Hou
2707f67c87 Add - and -= operators to BlockFrequency using saturating arithmetic.
llvm-svn: 250077
2015-10-12 18:34:00 +00:00
Cong Hou
3919ffc012 Use fixed-point representation for BranchProbability.
BranchProbability now is represented by its numerator and denominator in uint32_t type. This patch changes this representation into a fixed point that is represented by the numerator in uint32_t type and a constant denominator 1<<31. This is quite similar to the representation of BlockMass in BlockFrequencyInfoImpl.h. There are several pros and cons of this change:

Pros:

1. It uses only a half space of the current one.
2. Some operations are much faster like plus, subtraction, comparison, and scaling by an integer.

Cons:

1. Constructing a probability using arbitrary numerator and denominator needs additional calculations.
2. It is a little less precise than before as we use a fixed denominator. For example, 1 - 1/3 may not be exactly identical to 1 / 3 (this will lead to many BranchProbability unit test failures). This should not matter when we only use it for branch probability. If we use it like a rational value for some precise calculations we may need another construct like ValueRatio.

One important reason for this change is that we propose to store branch probabilities instead of edge weights in MachineBasicBlock. We also want clients to use probability instead of weight when adding successors to a MBB. The current BranchProbability has more space which may be a concern.

Differential revision: http://reviews.llvm.org/D12603

llvm-svn: 248633
2015-09-25 23:09:59 +00:00
Duncan P. N. Exon Smith
c9d18bd005 Support: Add missing header to BlockFrequencyTest.cpp, NFC
llvm-svn: 227825
2015-02-02 18:18:07 +00:00
Duncan P. N. Exon Smith
dc1467a909 Support: More BlockFrequencyTest => BranchProbabilityTest
llvm-svn: 207554
2014-04-29 16:44:59 +00:00
Duncan P. N. Exon Smith
ceb937b892 Support: BlockFrequencyTest => BranchProbabilityTest
Move a detailed test of `BranchProbability::scale()` from
`BlockFrequencyTest` over to `BranchProbabilityTest`.

llvm-svn: 207552
2014-04-29 16:40:17 +00:00
Duncan P. N. Exon Smith
c69dc1873d blockfreq: Defer to BranchProbability::scale() (again)
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.

llvm-svn: 207550
2014-04-29 16:31:29 +00:00
Michael Gottesman
2e697ee084 [block-freq] Add a right shift to BlockFrequency that saturates at 1.
llvm-svn: 197302
2013-12-14 02:24:22 +00:00
Michael Gottesman
bed87ce7a7 [block-freq] Update data in test case to be unsigned long long to fix mingw build.
llvm-svn: 195411
2013-11-22 05:00:51 +00:00
Michael Gottesman
e011e8ef82 [block-freq] Add BlockFrequency::scale that returns a remainder from the 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).

llvm-svn: 194950
2013-11-17 03:25:24 +00:00
Jakob Stoklund Olesen
e4b031bd1a Fix a bad overflow check pointed out by Ben.
llvm-svn: 185226
2013-06-28 21:51:18 +00:00
Jakob Stoklund Olesen
a9465b9413 Add a division operator to BlockFrequency.
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.

llvm-svn: 185184
2013-06-28 18:23:42 +00:00
Benjamin Kramer
30c35d5305 Revert "BlockFrequency: Saturate at 1 instead of 0 when multiplying a frequency with a branch probability."
This reverts commit r184584. Breaks PPC selfhost.

llvm-svn: 184590
2013-06-21 20:20:27 +00:00
Benjamin Kramer
3315e168ee BlockFrequency: Saturate at 1 instead of 0 when multiplying a frequency with 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.

llvm-svn: 184584
2013-06-21 19:30:05 +00:00
Chandler Carruth
f413c260cc Sort the #include lines for unittest/...
llvm-svn: 169250
2012-12-04 10:23:08 +00:00
Benjamin Kramer
eefb2c3ad6 For reasons I can't fathom MSVC supports ULL but not LLU suffixes on long long integer literals.
llvm-svn: 158648
2012-06-17 14:53:53 +00:00
Benjamin Kramer
0638353f56 Implement comparison operators for BranchProbability in a way that can't overflow INT64_MAX.
Add a test case for the edge case that triggers this. Thanks to Chandler for bringing this to my attention.

llvm-svn: 142794
2011-10-24 13:50:56 +00:00
Benjamin Kramer
9adc582e35 Add compare operators to BranchProbability and use it to determine if an edge is hot.
llvm-svn: 142751
2011-10-23 11:19:14 +00:00
Jakub Staszak
4e897c8ac3 Add test cases for BlockFrequency.
llvm-svn: 136244
2011-07-27 18:57:40 +00:00