In the ThinLTO compilation, if a function is inlined in the profiling binary, we need to inline it before annotation. If the callee is not available in the primary module, a first step is needed to import that callee function. For the current implementation, if the call is an indirect call, which has been promoted to >1 targets and inlined, SamplePGO will only import one target with the largest sample count. This patch fixed the bug to import all targets instead.
I'm not really following the flow of what is supposed to happen here. I see that the earlier code already does an iteration over findIndirectCallFunctionSamples - can/should this be combined with that?
Update comment (foo1 and foo2 also)