[PATCH] D30752: [PGO] Refactor the valule profile dumping function for ease of adding other profile kind

Rong Xu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 8 16:36:08 PST 2017


xur added inline comments.


================
Comment at: tools/llvm-profdata/llvm-profdata.cpp:559
         uint32_t NS = Func.getNumValueSites(IPVK_IndirectCallTarget);
-        OS << "    Indirect Target Results: \n";
-        TotalNumValueSites += NS;
         for (size_t I = 0; I < NS; ++I) {
           uint32_t NV = Func.getNumValueDataForSite(IPVK_IndirectCallTarget, I);
----------------
davidxl wrote:
> Better to extract the driver loop into a common function, eg: traverseAllValueSites, and then pass a lambda/callback to do different things such as collect stats or dumping.
it's hard to use a lambda function here as I need to function pointers with captures. I pass all the necessary data variables as the parameters instead. 


https://reviews.llvm.org/D30752





More information about the llvm-commits mailing list