The current basic block reordering always uses the "software trace cache" algorithm. That has a few problems:
1) It increases code size substantially; this makes it not suitable for -O1 or -Os, and not at all for some architectures; 2) but it is enabled for -Os and all targets; 3) and -O1 gets nothing, resulting in pretty jumpy code. This patch set adds a new simple greedy basic block reordering algorithm, adds a flag -freorder-blocks-algorithm=, and sets things up so that -O1 and -Os use the simple algo. Split into a few pieces for easier review. Every intermediate step works. Bootstrapped and tested on powerpc64-linux. There are two new fails in guality testresults for -Os. Is this okay for mainline? Segher Segher Boessenkool (4): bb-reorder: Split out STC bb-reorder: Add the "simple" algorithm bb-reorder: Add -freorder-blocks-algorithm= and wire it up bb-reorder: Documentation updates gcc/bb-reorder.c | 196 +++++++++++++++++++++++++++++++++++++++++++++++++--- gcc/common.opt | 13 ++++ gcc/doc/invoke.texi | 23 ++++-- gcc/flag-types.h | 7 ++ gcc/opts.c | 4 +- 5 files changed, 227 insertions(+), 16 deletions(-) -- 1.8.1.4