Tolerate negative offset when matching sample profile.
authorDehao Chen <dehao@google.com>
Wed, 21 Oct 2015 01:22:27 +0000 (01:22 +0000)
committerDehao Chen <dehao@google.com>
Wed, 21 Oct 2015 01:22:27 +0000 (01:22 +0000)
commit491ae53e26e5d7f615d25e2e79f1fe2f29c26241
tree96f688abc3f0c85826deecbdebee7a0c8d42d4cd
parentc75a25368946ce7dda69b34ee71ff79467de7afd
Tolerate negative offset when matching sample profile.

In some cases (as illustrated in the unittest), lineno can be less than the heade_lineno because the function body are included from some other files. In this case, offset will be negative. This patch makes clang still able to match the profile to IR in this situation.

http://reviews.llvm.org/D13914

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