The shrinkwrap optimization added in GCC 7 allows each callee-save to
be delayed and done only across blocks which need a particular callee-save.
Although this reduces unnecessary memory traffic on code paths that need
few callee-saves, it typically uses LDR/STR rather than LDP/STP. This
means more memory accesses and increased codesize, ~1.0% on average.
To improve this, if a particular callee-save must be saved/restored, also
add the adjacent callee-save to allow use of LDP/STP. This significantly
reduces codesize (for example gcc_r, povray_r, parest_r, xalancbmk_r are
1% smaller). This is a simple fix which can be backported. A more advanced
approach would scan blocks for pairs of callee-saves, but that requires a
full rewrite of all the callee-save code which is too late at this stage.
An example epilog in a shrinkwrapped function before: