http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53695
--- Comment #11 from rguenther at suse dot de <rguenther at suse dot de> 2012-08-23 07:36:46 UTC --- On Wed, 22 Aug 2012, steven at gcc dot gnu.org wrote: > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53695 > > --- Comment #9 from Steven Bosscher <steven at gcc dot gnu.org> 2012-08-22 > 21:33:18 UTC --- > I think the right fix for this bug is to use disambiguate_multiple_latches in > the loop updating code (fix_loop_structure), but I'm not sure where to put it. Not sure - we can handle multiple latches just fine (loop->latch will be NULL). But I see the loop state does not reflect that. Maybe Index: gcc/cfgloopmanip.c =================================================================== --- gcc/cfgloopmanip.c (revision 190613) +++ gcc/cfgloopmanip.c (working copy) @@ -1715,6 +1716,9 @@ fix_loop_structure (bitmap changed_bbs) } } + if (!loop_state_satisfies_p (LOOPS_MAY_HAVE_MULTIPLE_LATCHES)) + disambiguate_loops_with_multiple_latches (); + if (loops_state_satisfies_p (LOOPS_HAVE_PREHEADERS)) create_preheaders (CP_SIMPLE_PREHEADERS); which matches the order in which loop_optimizer_init calls it. Richard.