[llvm] [llvm-profgen] Filter out ambiguous cold profiles during profile generation (PR #81803)
Lei Wang via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 16 12:29:31 PST 2024
wlei-llvm wrote:
> As we discussed may worth trying to see if we can filter it earlier, if not, the current change looks good.
Thanks for the review. I checked that it's probably not easy to do it earlier. There are two places I can think in earlier phrase, both have diverged code to support.
1) Parsing symbol time in profiled binary, it's diverged for pseudo-probe and non-probe path:
For non-probe path, we needs to filter the symbol from debug info symbol.
For pseudo-probe path. we need to filter the symbol decoded from pseudo-probe sections, e.g. in buildGUID2FuncDescMap (https://github.com/llvm/llvm-project/blob/main/llvm/lib/MC/MCPseudoProbe.cpp#L379) filter the entry and then as the guid for those filtered function can still be decoded, we also have to either filter those guid or support to make sure all the guid lookup like `getProbeFNameForGUID` not break.
2) In the middle of profile generation, it's also diverged for pseudo-probe and non-probe path:
For non-probe path, it uses `getTopLevelFunctionProfile` to create a `FunctionSamples`(https://github.com/llvm/llvm-project/blob/main/llvm/tools/llvm-profgen/ProfileGenerator.cpp#L469)
For probe path, it uses `getFunctionProfileForLeafProbe` (https://github.com/llvm/llvm-project/blob/main/llvm/tools/llvm-profgen/ProfileGenerator.cpp#L1264)
And bothe of function's return type is "FunctionSamples &" not pointer, so there needs some downstream support for this.
https://github.com/llvm/llvm-project/pull/81803
More information about the llvm-commits
mailing list