New option -flimit-function-alignment

Denys Vlasenko
Tue Oct 11 14:24:00 GMT 2016

On 10/11/2016 04:11 PM, Bernd Schmidt wrote:
> Denys has submitted some patches to add more capabilities to the
> -falign-* options, but these still have some issues, and the original
> ideas seems to have been to allow for large alignments without
> over-aligning small functions. The following patch implements that
> idea by taking into account the function size as computed during
> shorten_branches: let's say we use "-falign-functions=128
> -flimit-function-alignment", then a 15-byte function will be 16-byte
> aligned rather than 128-byte aligned.
> Bootstrapped and tested on x86_64-linux. Denys, does this solve your
> problem?

This is better than current behavior, but this is not what I want.

15-byte function does not need to be aligned to 16 bytes on a machine
with 128-byte L1I cachelines. It needs to be aligned to 128 bytes
if there are less than 15 bytes remaining; if there are MORE than 15 bytes
remaining, why align at all? It's a waste of space.

More information about the Gcc-patches mailing list