This is an archive of the discontinued LLVM Phabricator instance.

[BOLT] Increase coverage of shrink wrapping [1/5]
ClosedPublic

Authored by rafauler on May 20 2022, 8:20 PM.

Details

Summary

Change how function score is calculated and provide more
detailed statistics when reporting back frame optimizer and shrink
wrapping results. In this new statistics, we provide dynamic coverage
numbers. The main metric for shrink wrapping is the number of executed
stores that were saved because of shrink wrapping (push instructions
that were either entirely moved away from the hot block or converted
to a stack adjustment instruction). There is still a number of reduced
load instructions (pop) that we are not counting at the moment. Also
update alloc combiner to report dynamic numbers, as well as frame
optimizer.

For debugging purposes, we also include a list of top 10 functions
optimized by shrink wrapping. These changes are aimed at better
understanding the impact of shrink wrapping in a given binary.

We also remove an assertion in dataflow analysis to do not choke on
empty functions (which makes no sense).

Diff Detail

Event Timeline

rafauler created this revision.May 20 2022, 8:20 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 20 2022, 8:20 PM
rafauler requested review of this revision.May 20 2022, 8:20 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 20 2022, 8:20 PM
Amir added inline comments.May 23 2022, 3:50 PM
bolt/include/bolt/Passes/ShrinkWrapping.h
522

clang-format?

rafauler updated this revision to Diff 432155.May 25 2022, 5:02 PM

Fix formatting

Amir accepted this revision.Jun 2 2022, 1:58 PM

LGTM, at least the code changes match the description.
One quick question: does this diff result in a functional change because the score is computed differently? Or the change from getKnownExecutionCount == 0 to getFunctionScore == 0 shouldn't result in a functional change?

This revision is now accepted and ready to land.Jun 2 2022, 1:58 PM

You're right that it does result in functional changes.

This revision was automatically updated to reflect the committed changes.