[PATCH] D30479: [PGO] Text format profile reader needs to clear the value profile
Rong Xu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 3 11:21:34 PST 2017
xur updated this revision to Diff 90513.
xur added a comment.
Integrated David's review comments.
https://reviews.llvm.org/D30479
Files:
include/llvm/ProfileData/InstrProf.h
lib/ProfileData/InstrProfReader.cpp
test/tools/llvm-profdata/value-prof.proftext
Index: test/tools/llvm-profdata/value-prof.proftext
===================================================================
--- test/tools/llvm-profdata/value-prof.proftext
+++ test/tools/llvm-profdata/value-prof.proftext
@@ -63,6 +63,15 @@
#ICTEXT-NEXT: foo2:20000
#
+bar
+# Func Hash:
+10
+# Num Counters:
+2
+# Counter Values:
+999000
+359800
+
#ICSUM: Total Number of Indirect Call Sites : 3
#ICSUM: Total Number of Sites With Values : 2
#ICSUM: Total Number of Profiled Values : 3
Index: lib/ProfileData/InstrProfReader.cpp
===================================================================
--- lib/ProfileData/InstrProfReader.cpp
+++ lib/ProfileData/InstrProfReader.cpp
@@ -233,7 +233,7 @@
return error(instrprof_error::malformed);
// Read each counter and fill our internal storage with the values.
- Record.Counts.clear();
+ Record.Clear();
Record.Counts.reserve(NumCounters);
for (uint64_t I = 0; I < NumCounters; ++I) {
if (Line.is_at_end())
Index: include/llvm/ProfileData/InstrProf.h
===================================================================
--- include/llvm/ProfileData/InstrProf.h
+++ include/llvm/ProfileData/InstrProf.h
@@ -635,6 +635,13 @@
SR.sortByCount();
}
}
+
+ /// Clear value data entries and edge counters.
+ void Clear() {
+ Counts.clear();
+ clearValueData();
+ }
+
/// Clear value data entries
void clearValueData() {
for (uint32_t Kind = IPVK_First; Kind <= IPVK_Last; ++Kind)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30479.90513.patch
Type: text/x-patch
Size: 1479 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170303/f10c4112/attachment.bin>
More information about the llvm-commits
mailing list