diff options
Diffstat (limited to 'gcc/passes.c')
-rw-r--r-- | gcc/passes.c | 31 |
1 files changed, 10 insertions, 21 deletions
diff --git a/gcc/passes.c b/gcc/passes.c index fe005199d8c..8828967d0d8 100644 --- a/gcc/passes.c +++ b/gcc/passes.c @@ -795,6 +795,10 @@ init_optimization_passes (void) NEXT_PASS (pass_cleanup_eh); NEXT_PASS (pass_profile); NEXT_PASS (pass_local_pure_const); + /* Split functions creates parts that are not run through + early optimizations again. It is thus good idea to do this + late. */ + NEXT_PASS (pass_split_functions); } NEXT_PASS (pass_release_ssa_names); NEXT_PASS (pass_rebuild_cgraph_edges); @@ -809,8 +813,8 @@ init_optimization_passes (void) NEXT_PASS (pass_ipa_profile); NEXT_PASS (pass_ipa_cp); NEXT_PASS (pass_ipa_inline); - NEXT_PASS (pass_ipa_reference); NEXT_PASS (pass_ipa_pure_const); + NEXT_PASS (pass_ipa_reference); NEXT_PASS (pass_ipa_type_escape); NEXT_PASS (pass_ipa_pta); NEXT_PASS (pass_ipa_struct_reorg); @@ -1120,7 +1124,7 @@ do_per_function (void (*callback) (void *data), void *data) keep the array visible to garbage collector to avoid reading collected out nodes. */ static int nnodes; -static GTY ((length ("nnodes"))) struct cgraph_node **order; +static GTY ((length ("nnodes"))) cgraph_node_ptr *order; /* If we are in IPA mode (i.e., current_function_decl is NULL), call function CALLBACK for every function in the call graph. Otherwise, @@ -1136,7 +1140,7 @@ do_per_function_toporder (void (*callback) (void *data), void *data) else { gcc_assert (!order); - order = GGC_NEWVEC (struct cgraph_node *, cgraph_n_nodes); + order = ggc_alloc_vec_cgraph_node_ptr (cgraph_n_nodes); nnodes = cgraph_postorder (order); for (i = nnodes - 1; i >= 0; i--) order[i]->process = 1; @@ -1175,8 +1179,6 @@ execute_function_todo (void *data) if (!flags) return; - statistics_fini_pass (); - /* Always cleanup the CFG before trying to update SSA. */ if (flags & TODO_cleanup_cfg) { @@ -1241,22 +1243,7 @@ execute_function_todo (void *data) } if (flags & TODO_rebuild_frequencies) - { - if (profile_status == PROFILE_GUESSED) - { - loop_optimizer_init (0); - add_noreturn_fake_exit_edges (); - mark_irreducible_loops (); - connect_infinite_loops_to_exit (); - estimate_bb_frequencies (); - remove_fake_exit_edges (); - loop_optimizer_finalize (); - } - else if (profile_status == PROFILE_READ) - counts_to_freqs (); - else - gcc_unreachable (); - } + rebuild_frequencies (); #if defined ENABLE_CHECKING if (flags & TODO_verify_ssa @@ -1288,6 +1275,8 @@ execute_todo (unsigned int flags) /* Inform the pass whether it is the first time it is run. */ first_pass_instance = (flags & TODO_mark_first_instance) != 0; + statistics_fini_pass (); + do_per_function (execute_function_todo, (void *)(size_t) flags); /* Always remove functions just as before inlining: IPA passes might be |