[llvm] [SampleFDO] Stale profile call-graph matching (PR #95135)
Lei Wang via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 17 17:45:06 PDT 2024
wlei-llvm wrote:
> Does the algorithm need to be iterative? For instance, at top level we have profile function 'foo' calling profile function bar, and IR function 'foo_new' calling IR function 'bar_new'. Can the algorithm recursively match bar with bar_new? If yes, perhaps add a test case.
It works to handle the recursive function matching. It's not strictly iterative but process the functions in a top-down order and the callee's processing can reuse the caller's matching result. For that example, say the top-down order is
`main` --> `foo_new` -->`bar_new`
It first process main, and run matching on main's callee sequences(which includes `foo_new`), it identifies `foo_new` --> `foo`, Note that main's process is done and return,(doesn't recursively process callee in main's process)
Then it start a new instance to process `foo_new`, which is found to match `foo` and then it run on its callee sequences matching to identifies `bar_new` --> `bar`
The tricky part here is when a function is top-level function, right now the reader doesn't load the matched profile(which is unused), we need some work for this. I will add a test for non-top-level profile.
https://github.com/llvm/llvm-project/pull/95135
More information about the llvm-commits
mailing list