===================================================================
@@ -379,7 +379,12 @@ tracer (void)
/* Trace formation is done on the fly inside tail_duplicate */
changed = tail_duplicate ();
if (changed)
- free_dominance_info (CDI_DOMINATORS);
+ {
+ free_dominance_info (CDI_DOMINATORS);
+ calculate_dominance_info (CDI_DOMINATORS);
+ if (current_loops)
+ fix_loop_structure (NULL);
+ }
if (dump_file)
brief_dump_cfg (dump_file, dump_flags);
===================================================================
@@ -1586,6 +1586,7 @@ force_single_succ_latches (void)
continue;
e = find_edge (loop->latch, loop->header);
+ gcc_checking_assert (e != NULL);
split_edge (e);
}
@@ -1848,6 +1849,32 @@ fix_loop_structure (bitmap changed_bbs)
}
}
+ /* Then re-compute the single latch if there is one. */
+ FOR_EACH_LOOP (li, loop, 0)
+ {
+ edge_iterator ei;
+ edge e, latch = NULL;
+ FOR_EACH_EDGE (e, ei, loop->header->preds)
+ if (dominated_by_p (CDI_DOMINATORS, e->src, loop->header))
+ {
+ if (!latch)
+ latch = e;
+ else
+ {
+ latch = NULL;
+ break;
+ }
+ }
+ if (latch
+ && latch->src->loop_father == loop)
+ loop->latch = latch->src;
+ else
+ loop->latch = NULL;
+ }
+
+ if (!loops_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);