The inliner not being a function pass requires the work-around of
generating the OptimizationRemarkEmitter and in turn BFI on demand.
This will go away after the new PM is ready.
BFI is only computed inside ORE if the user has requested hotness information for optimization diagnostitics (-pass-remark-with-hotness at the 'opt' level). Thus there is no additional overhead without the flag.
This needs a proper doxygen comment, especially regarding the cost of doing this. And doubly especially that it is free unless the context has the hotness emission specifically enabled. I had to read the implementation to understand why this is OK. =[
I'll also note that this applies to this entire file which seems ... remarkably devoid of doxygen API comments. Please document this interface and infrastructure in subsequent commits. =/