http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54146
--- Comment #33 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-08-08 08:09:25 UTC --- (In reply to comment #29) > Created attachment 27957 [details] > Do not traverse sibling loops > > The idea here is to note that for a nested loop we know for sure that the loop > exits into a common loop father must all need PHI nodes, because we have have > loop pre-headers. I'm not sure what the effect of this is on irreducible > loops, > and I haven't tested this much yet. Comments sought... Nice results. A few comments - if you rely on preheaders then please assert in rewrite_into_loop_closed_ssa that loops_state_satisfies_p (LOOPS_HAVE_PREHEADERS). Irreducible loops are "one" loop to cfgloop and to loop-closed SSA form, so they should be fine. What do you mean by "for a nested loop we know for sure that the loop exits into a common loop father must all need PHI nodes"? What happens for nested loops that do not exit into a common loop father? That is what's "common" here? I think what you want to say is that a loop cannot exit to a child of a sibling of a father, thus: for (;;) for (;;) goto x; for (;;) x: cannot happen in the sense that loop detection would not detect the loop nest as written (but had a single irreducible loop)? I think you should simply move compute_global_livein to its single use and make it static.