From 044eb2f6afba375a914ac9d8024f8f5142bb912e Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Mon, 18 Dec 2017 20:10:56 +0000 Subject: Vendor import of llvm trunk r321017: https://llvm.org/svn/llvm-project/llvm/trunk@321017 --- lib/ProfileData/SampleProfWriter.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'lib/ProfileData/SampleProfWriter.cpp') diff --git a/lib/ProfileData/SampleProfWriter.cpp b/lib/ProfileData/SampleProfWriter.cpp index b45026140c99..59c4885fcdbe 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; @@ -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. -- cgit v1.3