diff options
author | Dehao Chen <dehao@google.com> | 2017-08-03 00:09:18 +0000 |
---|---|---|
committer | Dehao Chen <dehao@google.com> | 2017-08-03 00:09:18 +0000 |
commit | ca9f2fdb1929bc8725813fe9481f0d72b764c7a7 (patch) | |
tree | 1021300f0d8686d979f4a4772ee8e05f93c70db8 /lib/ProfileData | |
parent | d7247b5f8fe9d47a26ba1ff2de1c63491ba526c8 (diff) |
Fix the bug when SampleProfileWriter writes out number of callsites.
Summary: As we support multiple callsites for the same location, we need to traverse all locations to get the number of callsites.
Reviewers: davidxl
Reviewed By: davidxl
Subscribers: sanjoy, llvm-commits
Differential Revision: https://reviews.llvm.org/D36246
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309907 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ProfileData')
-rw-r--r-- | lib/ProfileData/SampleProfWriter.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/ProfileData/SampleProfWriter.cpp b/lib/ProfileData/SampleProfWriter.cpp index b45026140c9..b9d357ab15e 100644 --- a/lib/ProfileData/SampleProfWriter.cpp +++ b/lib/ProfileData/SampleProfWriter.cpp @@ -222,7 +222,10 @@ std::error_code SampleProfileWriterBinary::writeBody(const FunctionSamples &S) { } // Recursively emit all the callsite samples. - encodeULEB128(S.getCallsiteSamples().size(), OS); + uint64_t NumCallsites = 0; + for (const auto &J : S.getCallsiteSamples()) + NumCallsites += J.second.size(); + encodeULEB128(NumCallsites, OS); for (const auto &J : S.getCallsiteSamples()) for (const auto &FS : J.second) { LineLocation Loc = J.first; |