[MachineOutliner] Sort Outlining Functions by Priority #88990
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We changed the order in which functions are outlined in Machine Outliner.
In MachineOutliner::outline(), functions are sorted by their benefits first and then outlined one at a time greedily. Our investigation shows that sorting the functions by a different value, which we call priority, could be more beneficial. For clang, sorting the functions by priority reduces the binary size by 1.8% compared to the baseline; if we additionally consider leaf descendants to include more candidates, the binary size is reduced by 2.8% compared to the baseline.
The formula for priority is found via a black-box Bayesian optimization toolbox, and we have shown that using this formula for sorting consistently reduces uncompressed mobile app size within our company.