A context can be created by invoking the getFunctionProfileForContext function in two ways:
- by using a probe and its calling context.
- by removing the leaf frame from an existing contexts. The first way is used when generating a function profile for a given LBR range, and the input WasLeafInlined is computed depending on the actually probe in the LBR range. The second way is used when using the entry count of an inlinee function profile to update its inliner callsite count, so WasLeafInlined is unknown for the inliner frame.
The two invocations can happen in different order on different platforms, since the lbr ranges are stored in an unordered_map, and we are making sure ContextWasInlined is always set correctly.
This should fix the random test failure introduced by D121655
This fix assumes that the 1st is always going to be called for given context, and it's just a matter of order. Is that actually true?
What is the exact call path for both cases?