[PATCH] D51643: [SampleFDO] Make sample profile loader unaware of compact format change

Wei Mi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 5 09:24:18 PDT 2018


wmi added inline comments.


================
Comment at: include/llvm/ProfileData/SampleProf.h:461
+        GUIDToFuncNameMap.insert({Function::getGUID(OrigName), OrigName});
+        auto pos = OrigName.find('.');
+        if (pos != StringRef::npos) {
----------------
davidxl wrote:
> Add comments on this code about the substr mapping.
Ok, will do. 


================
Comment at: test/Transforms/SampleProfile/Inputs/function_metadata.prof:1
-test:10000:0
+test:3200:0
+ 1: 100
----------------
davidxl wrote:
> why changing the profile data?
Because in function_metadata.prof, the total sample count of a function doesn't equal to the added up count of all the samples in the function body. SampleProfileReader will not care about the inconsistency and will use the incorrect total sample count directly. 

However, the autofdo dumping and other conversion tool will discard the incorrect total count and recompute it according to the added up count of samples inside function body. 

The test was to verify different formats converted from the same profile will generate the same results, so I needed to make the total sample count consistent with how it is computed.  


Repository:
  rL LLVM

https://reviews.llvm.org/D51643





More information about the llvm-commits mailing list