SamplePGO - Add flag to check sampling coverage.
authorDiego Novillo <dnovillo@google.com>
Wed, 28 Oct 2015 22:30:25 +0000 (22:30 +0000)
committerDiego Novillo <dnovillo@google.com>
Wed, 28 Oct 2015 22:30:25 +0000 (22:30 +0000)
commitbcb1df36b725ca52eedbecd6c331152e59d798a5
tree3a6edbb8fe321378d9d8753c1ffe978ad2919d97
parent16624bec2f7d679beb71c8d8ed1a9f0d010b9ff3
SamplePGO - Add flag to check sampling coverage.

This adds the flag -mllvm -sample-profile-check-coverage=N to the
SampleProfile pass. N is the percent of input sample records that the
user expects to apply.  If the pass does not use N% (or more) of the
sample records in the input, it emits a warning.

This is useful to detect some forms of stale profiles. If the code has
drifted enough from the original profile, there will be records that do
not match the IR anymore.

This will not detect cases where a sample profile record for line L is
referring to some other instructions that also used to be at line L.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251568 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/IPO/SampleProfile.cpp
test/Transforms/SampleProfile/Inputs/coverage-warning.prof [new file with mode: 0644]
test/Transforms/SampleProfile/coverage-warning.ll [new file with mode: 0644]