[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
Tue Feb 28 15:39:54 PST 2017


xur created this revision.

Reset the ValueData for each function to avoid using the ones in
the previous function.


https://reviews.llvm.org/D30479

Files:
  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
@@ -244,6 +244,7 @@
     Record.Counts.push_back(Count);
   }
 
+  Record.clearValueData();
   // Check if value profile data exists and read it if so.
   if (Error E = readValueProfileData(Record))
     return E;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30479.90094.patch
Type: text/x-patch
Size: 894 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170228/959eb625/attachment.bin>


More information about the llvm-commits mailing list