[PATCH] D31950: SamplePGO: convert callsite samples map key from callsite_location to callsite_location+callee_name

Dehao Chen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 13 10:13:09 PDT 2017


danielcdh added inline comments.


================
Comment at: include/llvm/ProfileData/SampleProf.h:281
+      return &FS->getValue();
+    // If we cannot find exact match of the callee name, return the FS with
+    // the max total count.
----------------
davidxl wrote:
> Is it correct to return the max count samples? What is the reason this is needed?
Sometimes, the callsite does not have full callee name in the debug info/afdo profile because the linkage name for internal functions were not emitted. There are also cases that the function name get changed during refactoring. So if we cannot find exact match, we want to have the best-effort matching.

There is no correctness concern because even if the profile is completely incorrect, we can still emit correct (but inefficient code).

And for this specific case, different callee_name with the same callsite_loc only applies to profiles collected from speculatively promoted indirect call (with > 1 targets), which is rare. So the best-effort match here is most likely one-target-match, which falls back to the case without the patch.


https://reviews.llvm.org/D31950





More information about the llvm-commits mailing list