summaryrefslogtreecommitdiffstats
path: root/gnu/llvm/lib/ProfileData/SampleProfWriter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/llvm/lib/ProfileData/SampleProfWriter.cpp')
-rw-r--r--gnu/llvm/lib/ProfileData/SampleProfWriter.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/gnu/llvm/lib/ProfileData/SampleProfWriter.cpp b/gnu/llvm/lib/ProfileData/SampleProfWriter.cpp
index b45026140c9..59c4885fcdb 100644
--- a/gnu/llvm/lib/ProfileData/SampleProfWriter.cpp
+++ b/gnu/llvm/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;
@@ -248,8 +251,6 @@ std::error_code SampleProfileWriterBinary::write(const FunctionSamples &S) {
///
/// \param Filename The file to create.
///
-/// \param Writer The writer to instantiate according to the specified format.
-///
/// \param Format Encoding format for the profile file.
///
/// \returns an error code indicating the status of the created writer.
@@ -271,8 +272,6 @@ SampleProfileWriter::create(StringRef Filename, SampleProfileFormat Format) {
///
/// \param OS The output stream to store the profile data to.
///
-/// \param Writer The writer to instantiate according to the specified format.
-///
/// \param Format Encoding format for the profile file.
///
/// \returns an error code indicating the status of the created writer.