Fix cache of inlining costs and streamline the logic
Summary:
When a unit is incomplete and the function is still being profiled, the cost
shouldn't be cached unless we're sure that the cost is going to be excessive.
The code was checking this, but there was a bug: the decision about how much is
excessive was dependent on the context where the inlining was happening. If
this happened deep in an inlining chain, the budget left for inlining could be
very small, and so we'd prevent inlining that candidate everywhere forever. The
fix here is simply to do the same check against the global maximum cost that we
allow for an inlining candidate.
While here, I reworked the logic to handle caching of incomplete regions.
Reviewed By: markw65
Differential Revision:
D7984534
fbshipit-source-id:
d84364279a79409db9bb71a22598b82f0c919084