This adds the following to the new PM based inliner in PGO mode:
- Use block frequency analysis to derive callsite's profile count and use that to adjust thresholds of hot and cold callsites.
- Incrementally update the BFI of the caller after a callee gets inlined into it. This incremental update is only within an invocation of the run method - BFI is not preserved across calls to run.
- Update the function entry count of the callee after inlining it into a caller.
I've tuned the thresholds for the hot and cold callsites using a hacked up version of the old inliner that explicitly computes BFI on a set of internal benchmarks and spec. Once the new PM based pipeline stabilizes (IIRC Chandler mentioned there are known issues) I'll benchmark this again and adjust the thresholds if required.
I would use llvm's function_ref rather than std::function -- it is much lighter weight and the caller can ensure that the function object outlives the call.
Also, I would prefer Optional<function_ref<...>> over function_ref<...>* as the pointer seems a more error prone API.