[PATCH] D34694: llvm-profdata: Indirect infrequently used fields to reduce memory usage

David Li via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 27 09:46:53 PDT 2017


davidxl added a comment.

Yes, in general, the profile data is very sparse for large applications. Only a small percentage of modules have non-zero profile counts.   Unlike edge/block profile which is statically allocated, the value profile data is created on-demand, this makes it possible to take advantage the sparsity as your patch does.

Regarding the followup change, here is my suggestion:

1. refactor InstrProfRecord into two parts, one part is the identification related including name, hash, etc, and the second part includes only counters -- InstrProfRecord becomes a wrapper class.
2. InstrProfWriter can use the counter record and maintains its own mapping.



================
Comment at: include/llvm/ProfileData/InstrProf.h:716
   std::vector<InstrProfValueSiteRecord> &
   getValueSitesForKind(uint32_t ValueKind) {
+    if (!ValueData)
----------------
Can we change the interface to return ArrayRef so that 
1) we don't need empty vector
2) no need to duplicate the const/non-const version of the method?


https://reviews.llvm.org/D34694





More information about the llvm-commits mailing list