Use discriminator information in sample profiles.

Summary:
When the sample profiles include discriminator information,
use the discriminator values to distinguish instruction weights
in different basic blocks.

This modifies the BodySamples mapping to map <line, discriminator> pairs
to weights. Instructions on the same line but different blocks, will
use different discriminator values. This, in turn, means that the blocks
may have different weights.

Other changes in this patch:

- Add tests for positive values of line offset, discriminator and samples.
- Change data types from uint32_t to unsigned and int and do additional
  validation.

Reviewers: chandlerc

CC: llvm-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D2857

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203508 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Diego Novillo
2014-03-10 22:41:28 +00:00
parent e45534d027
commit 87393cfd6b
11 changed files with 254 additions and 91 deletions

View File

@@ -0,0 +1,2 @@
empty:100:0
1.-3: 10

View File

@@ -0,0 +1,2 @@
empty:100:0
-1: 10

View File

@@ -0,0 +1,2 @@
empty:100:0
1.3: -10

View File

@@ -3,9 +3,8 @@ _Z3sumii:105580:5279
1: 5279
2: 5279
main:225715:0
2: 5553
2.1: 5553
3: 5391
# This indicates that at line 3 of this function, the 'then' branch
# of the conditional is taken (discriminator '1'). However, we still
# do not handle this case, so we compute the wrong branch weights here.
# of the conditional is taken (discriminator '1').
3.1: 5752 _Z3sumii:5860

View File

@@ -0,0 +1,8 @@
foo:1000:0
1: 1
2: 1
2.1: 100
3: 100
3.1: 5
4: 100
5: 1