For iterative SamplePGO, an indirect call can be speculatively promoted to multiple direct calls and get inlined. All these promoted direct calls will share the same callsite location (offset+discriminator). With the current implementation, we cannot distinguish between different promotion candidates and its inlined instance. This patch adds callee_name to the key of the callsite sample map. And added helper functions to get all inlined callee samples for a given callsite location. This helps the profile annotator promote correct targets and inline it before annotation, and ensures all indirect call targets to be annotated correctly.
Details
Diff Detail
- Build Status
Buildable 5462 Build 5462: arc lint + arc unit
Event Timeline
include/llvm/ProfileData/SampleProf.h | ||
---|---|---|
281 | Is it correct to return the max count samples? What is the reason this is needed? |
include/llvm/ProfileData/SampleProf.h | ||
---|---|---|
281 | 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. |
do you need to use const & here? just 'auto FS = ..'