A function call can be replicated by optimizations like loop unroll and jump threading and the replicates end up sharing the sample nested callee profile. Therefore when it comes to merging samples for uninlined callees in the sample profile inliner, a callee profile can be merged multiple times which will cause an assert to fire.
This change avoids merging same callee profile for duplicate callsites by filtering out callee profiles with a non-zero head sample count.
A comment explain the check? e.g. we want to merge it exactly once as earlier pass may have duplicated the call site already, and when duplicating, we don't slicing the original inlinee's profile.