Basic block reordering in GCC

Jim Wilson jimw@sifive.com
Wed Aug 5 20:57:10 GMT 2020


On Tue, Aug 4, 2020 at 10:29 PM Mahmood Naderan via Gcc-help
<gcc-help@gcc.gnu.org> wrote:
> Is it possible to modify the basic block reordering algorithm to call the next BB from another function? From what I have seen in -freorder-blocks and -freorder-blocks-algorithm and -freorder-fucntion, it seems that BBs are reordered inside functions, a.k.a intra-function reordering, and not between fucntions, a.k.a inter-functions.
> Any nore on that?

Putting code from one function inside another function would seriously
complicate a lot of stuff, and probably break some stuff too.  There
is a -freorder-blocks-and-partition option that can move hot blocks to
a special hot section and cold blocks to a special cold section.  But
there are a number of cases where it gets automatically disabled, e.g.
in the presence of exception handling, if the function has a section
attribute, etc.  See the docs for the full list.

Jim


More information about the Gcc-help mailing list