http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56181
--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> 2013-02-05 12:16:08 UTC --- So, what happens here is that tracer performs tail-duplication. That is per se of course fine, but when we're re-scanning bodies in fix_loop_structure, we correctly mark BBs in the loop 1, then the loop 3, but then when processing the loop 2, in flow_loop_nodes_find, we mark tail-duplicated BB as belonging into the loop 2, because FOR_EACH_EDGE (latch, latch_ei, loop->header->preds) { if (latch->src->loop_father == loop || !dominated_by_p (CDI_DOMINATORS, latch->src, loop->header)) continue; doesn't notice that the BB is in fact outside of the loop. Which is bad - we then process predecessors of that BB and mark the BBs in loop 3 as belonging into loop 2. Oops.