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

David Li via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 23 15:19:32 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:
> > 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.


https://reviews.llvm.org/D44847





More information about the llvm-commits mailing list