llvm.org GIT mirror llvm / ca9f2fd
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 Dehao Chen 2 years ago
2 changed file(s) with 8 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
221221 }
222222
223223 // Recursively emit all the callsite samples.
224 encodeULEB128(S.getCallsiteSamples().size(), OS);
224 uint64_t NumCallsites = 0;
225 for (const auto &J : S.getCallsiteSamples())
226 NumCallsites += J.second.size();
227 encodeULEB128(NumCallsites, OS);
225228 for (const auto &J : S.getCallsiteSamples())
226229 for (const auto &FS : J.second) {
227230 LineLocation Loc = J.first;
99 6: 2080
1010 7: 534
1111 9: 2064 _Z3bari:1471 _Z3fooi:631
12 10: inline1:1000
13 1: 1000
14 10: inline2:2000
15 1: 2000