make_single_succ_edge (bb, EXIT_BLOCK_PTR_FOR_FN (cfun), EDGE_FAKE);
}
-/* This function adds a fake edge between any infinite loops to the
- exit block. Some optimizations require a path from each node to
- the exit node.
+/* This function adds a fake edge between any noreturn block and
+ infinite loops to the exit block. Some optimizations require a path
+ from each node to the exit node.
See also Morgan, Figure 3.10, pp. 82-83.
void
connect_infinite_loops_to_exit (void)
{
+ /* First add fake exits to noreturn blocks, this is required to
+ discover only truly infinite loops below. */
+ add_noreturn_fake_exit_edges ();
+
/* Perform depth-first search in the reverse graph to find nodes
reachable from the exit block. */
depth_first_search dfs;
if (!pdoms_calculated)
{
gcc_checking_assert (cfun);
- add_noreturn_fake_exit_edges ();
connect_infinite_loops_to_exit ();
calculate_dominance_info (CDI_POST_DOMINATORS);
pdoms_calculated = true;
{
basic_block bb;
- add_noreturn_fake_exit_edges ();
connect_infinite_loops_to_exit ();
/* We use loop_niter_by_eval, which requires that the loops have
preheaders. */
if (profile_status_for_fn (cfun) == PROFILE_GUESSED)
{
loop_optimizer_init (0);
- add_noreturn_fake_exit_edges ();
mark_irreducible_loops ();
connect_infinite_loops_to_exit ();
estimate_bb_frequencies (true);
/* Now compute kill & transp vectors. */
build_store_vectors ();
- add_noreturn_fake_exit_edges ();
connect_infinite_loops_to_exit ();
edge_list = pre_edge_rev_lcm (num_stores, st_transp, st_avloc,