On Fri, Oct 09, 2015 at 11:29:16AM +0200, Richard Biener wrote: > I think the patch makes sense but it also raises a question for me - how > did we decide what edge gets EDGE_FALLTHRU when going out-of-cfglayout?
Good question. I think it just tries to make "natural" control flow; I'll investigate. > And isn't _that_ mechanism then not part of basic-block reordering that > needs to be tweaked for choosing the EDGE_FALLTHRU as better? Yes. This patch uses the existing fallthrough for conditional branches, which seems to work best; but it still can significantly improve on unconditional branches. I'm sure there are better heuristics possible but I don't know them (and actually *solving* the problem isn't even polynomial of course). Segher