[PATCH] D36246: Fix the bug when SampleProfileWriter writes out number of callsites.
Dehao Chen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 2 15:48:41 PDT 2017
danielcdh created this revision.
Herald added a subscriber: sanjoy.
As we support multiple callsites for the same location, we need to traverse all locations to get the number of callsites.
https://reviews.llvm.org/D36246
Files:
lib/ProfileData/SampleProfWriter.cpp
test/tools/llvm-profdata/Inputs/sample-profile.proftext
Index: test/tools/llvm-profdata/Inputs/sample-profile.proftext
===================================================================
--- test/tools/llvm-profdata/Inputs/sample-profile.proftext
+++ test/tools/llvm-profdata/Inputs/sample-profile.proftext
@@ -10,3 +10,7 @@
6: 2080
7: 534
9: 2064 _Z3bari:1471 _Z3fooi:631
+ 10: inline1:1000
+ 1: 1000
+ 10: inline2:2000
+ 1: 2000
Index: lib/ProfileData/SampleProfWriter.cpp
===================================================================
--- lib/ProfileData/SampleProfWriter.cpp
+++ lib/ProfileData/SampleProfWriter.cpp
@@ -222,7 +222,10 @@
}
// 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;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36246.109445.patch
Type: text/x-patch
Size: 981 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170802/9de15360/attachment.bin>
More information about the llvm-commits
mailing list