diff options
author | Nathan Slingerland <slingn@gmail.com> | 2015-12-16 21:45:43 +0000 |
---|---|---|
committer | Nathan Slingerland <slingn@gmail.com> | 2015-12-16 21:45:43 +0000 |
commit | 48dd080c77c6a6398906b6db73d015fee15d8591 (patch) | |
tree | 4ecca36c8ea7d92f85c74274579a16d277b75e13 /llvm/tools/llvm-profdata | |
parent | 031bed291ee7feccd2272efac2f7fce98c8353de (diff) | |
download | bcm5719-llvm-48dd080c77c6a6398906b6db73d015fee15d8591.tar.gz bcm5719-llvm-48dd080c77c6a6398906b6db73d015fee15d8591.zip |
[PGO] Handle and report overflow during profile merge for all types of data
Summary: Surface counter overflow when merging profile data. Merging still occurs on overflow but counts saturate to the maximum representable value. Overflow is reported to the user.
Reviewers: davidxl, dnovillo, silvas
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D15547
llvm-svn: 255825
Diffstat (limited to 'llvm/tools/llvm-profdata')
-rw-r--r-- | llvm/tools/llvm-profdata/llvm-profdata.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/tools/llvm-profdata/llvm-profdata.cpp b/llvm/tools/llvm-profdata/llvm-profdata.cpp index 4fa36c4b0b6..71768f92382 100644 --- a/llvm/tools/llvm-profdata/llvm-profdata.cpp +++ b/llvm/tools/llvm-profdata/llvm-profdata.cpp @@ -180,7 +180,11 @@ static void mergeSampleProfile(const WeightedFileVector &Inputs, I != E; ++I) { StringRef FName = I->first(); FunctionSamples &Samples = I->second; - ProfileMap[FName].merge(Samples, Input.Weight); + sampleprof_error Result = ProfileMap[FName].merge(Samples, Input.Weight); + if (Result != sampleprof_error::success) { + std::error_code EC = make_error_code(Result); + handleMergeWriterError(EC, Input.Filename, FName); + } } } Writer->write(ProfileMap); |