http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54458
--- Comment #7 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-09-03 14:27:27 UTC --- I'm testing Index: gcc/tree-ssa-threadupdate.c =================================================================== --- gcc/tree-ssa-threadupdate.c (revision 190889) +++ gcc/tree-ssa-threadupdate.c (working copy) @@ -1037,11 +1037,21 @@ thread_through_loop_header (struct loop } free (bblocks); + /* If the new header has multiple latches mark it so. */ + FOR_EACH_EDGE (e, ei, loop->header->preds) + if (e->src->loop_father == loop + && e->src != loop->latch) + { + loop->latch = NULL; + loops_state_set (LOOPS_MAY_HAVE_MULTIPLE_LATCHES); + } + /* Cancel remaining threading requests that would make the loop a multiple entry loop. */ FOR_EACH_EDGE (e, ei, header->preds)