Use discriminator information in sample profiles.
authorDiego Novillo <dnovillo@google.com>
Mon, 10 Mar 2014 22:41:28 +0000 (22:41 +0000)
committerDiego Novillo <dnovillo@google.com>
Mon, 10 Mar 2014 22:41:28 +0000 (22:41 +0000)
commit87393cfd6b4e85e1b9baf804784e69dde30e019a
tree23b95c279d8d57da052fca5c68190bd96590f1a8
parente45534d027c685561d6da233e3cf5e0c1dde726c
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
lib/Transforms/Scalar/SampleProfile.cpp
test/Transforms/SampleProfile/Inputs/bad_discriminator_value.prof [new file with mode: 0644]
test/Transforms/SampleProfile/Inputs/bad_line_values.prof [new file with mode: 0644]
test/Transforms/SampleProfile/Inputs/bad_samples.prof [new file with mode: 0644]
test/Transforms/SampleProfile/Inputs/calls.prof
test/Transforms/SampleProfile/Inputs/discriminator.prof [new file with mode: 0644]
test/Transforms/SampleProfile/branch.ll
test/Transforms/SampleProfile/calls.ll
test/Transforms/SampleProfile/discriminator.ll [new file with mode: 0644]
test/Transforms/SampleProfile/propagate.ll
test/Transforms/SampleProfile/syntax.ll