diff options
author | Kyle Butt <kyle+llvm@iteratee.net> | 2017-03-03 01:00:22 +0000 |
---|---|---|
committer | Kyle Butt <kyle+llvm@iteratee.net> | 2017-03-03 01:00:22 +0000 |
commit | 1fa60307675bd08213ee7ac9638776e9f677a2c6 (patch) | |
tree | 1934917e963f0e97c8b367565ddb0537cf40b77b /llvm/lib/ProfileData/SampleProfWriter.cpp | |
parent | c00e45eada5eeb0a0695f23b14049ad71b89f27f (diff) | |
download | bcm5719-llvm-1fa60307675bd08213ee7ac9638776e9f677a2c6.tar.gz bcm5719-llvm-1fa60307675bd08213ee7ac9638776e9f677a2c6.zip |
CodeGen: BlockPlacement: Precompute layout for chains of triangles.
For chains of triangles with small join blocks that can be tail duplicated, a
simple calculation of probabilities is insufficient. Tail duplication
can be profitable in 3 different ways for these cases:
1) The post-dominators marked 50% are actually taken 56% (This shrinks with
longer chains)
2) The chains are statically correlated. Branch probabilities have a very
U-shaped distribution.
[http://nrs.harvard.edu/urn-3:HUL.InstRepos:24015805]
If the branches in a chain are likely to be from the same side of the
distribution as their predecessor, but are independent at runtime, this
transformation is profitable. (Because the cost of being wrong is a small
fixed cost, unlike the standard triangle layout where the cost of being
wrong scales with the # of triangles.)
3) The chains are dynamically correlated. If the probability that a previous
branch was taken positively influences whether the next branch will be
taken
We believe that 2 and 3 are common enough to justify the small margin in 1.
The code pre-scans a function's CFG to identify this pattern and marks the edges
so that the standard layout algorithm can use the computed results.
llvm-svn: 296845
Diffstat (limited to 'llvm/lib/ProfileData/SampleProfWriter.cpp')
0 files changed, 0 insertions, 0 deletions