[PATCH] D44847: [profile] Fix value profile runtime merging issues

David Li via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 24 09:39:44 PDT 2018


davidxl added inline comments.


================
Comment at: lib/profile/InstrProfilingFile.c:230
+  // (which can leave garbage at the end of profile file).
+  if (!VPMergeHook)
+    truncate(ProfileFileName, 0);
----------------
xur wrote:
> davidxl wrote:
> > xur wrote:
> > > davidxl wrote:
> > > > non value profiling data has fixed size, so why is this needed?
> > > Because there are still value counts in both in-memory and in-disk profiles.
> > > 
> > > Using the test in the patch as the example (running on my machine).
> > > assuming the binary is named as 'gen' and VPMergeHook null.
> > > 
> > > if we don't do online merge,
> > > "gen" will generate a profile of size 320 bytes.
> > > "gen 1" will generate a profile with size of 352 bytes
> > > 
> > > If we run "gen 1 && gen", the result binary is still 352 bytes.
> > > But the effective size is 320 bytes. The tail 32 bytes are trash.
> > > 
> > > 
> > Without VpMergeHook, we should assert that there is no value profile data -- it should not be dumped in the first place.
> current behavior is to write out the in-memory value profile data and discard the value profile data in the file. if there is not value profile from the file, the result is still correct.
> 
> I'm not familiar with the use cast the not having libc (where VPMergeHook will be nullptr). Is it not suppose to have any value profile?
> 
> I can assert VPMergeHook==nullptr and in-memory valuesites are not empty. That will be easy. Is this what you suggested?
In lprofGetVPDataReader method, returns null if VPMergeHook is null.


https://reviews.llvm.org/D44847





More information about the llvm-commits mailing list