Ok. David
On Fri, Jan 10, 2014 at 1:50 PM, Dehao Chen <de...@google.com> wrote: > This patch moves the LIPO linking before profile annotation so that > iterative-early-inline can cover functions from aux-module. > > Bootstrapped and passed regression test and benchmark test. > > OK for google-4_8? > > Thanks, > Dehao > > Index: gcc/auto-profile.c > =================================================================== > --- gcc/auto-profile.c (revision 206534) > +++ gcc/auto-profile.c (working copy) > @@ -1450,6 +1450,13 @@ auto_profile (void) > init_node_map (); > profile_info = autofdo::afdo_profile_info; > > + cgraph_pre_profiling_inlining_done = true; > + cgraph_process_module_scope_statics (); > + /* Now perform link to allow cross module inlining. */ > + cgraph_do_link (); > + varpool_do_link (); > + cgraph_unify_type_alias_sets (); > + > FOR_EACH_FUNCTION (node) > { > if (!gimple_has_body_p (node->symbol.decl)) > @@ -1461,6 +1468,35 @@ auto_profile (void) > > push_cfun (DECL_STRUCT_FUNCTION (node->symbol.decl)); > > + if (L_IPO_COMP_MODE) > + { > + basic_block bb; > + FOR_EACH_BB (bb) > + { > + gimple_stmt_iterator gsi; > + for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) > + { > + gimple stmt = gsi_stmt (gsi); > + if (is_gimple_call (stmt)) > + lipo_fixup_cgraph_edge_call_target (stmt); > + } > + } > + } > + rebuild_cgraph_edges (); > + pop_cfun (); > + } > + > + FOR_EACH_FUNCTION (node) > + { > + if (!gimple_has_body_p (node->symbol.decl)) > + continue; > + > + /* Don't profile functions produced for builtin stuff. */ > + if (DECL_SOURCE_LOCATION (node->symbol.decl) == BUILTINS_LOCATION) > + continue; > + > + push_cfun (DECL_STRUCT_FUNCTION (node->symbol.decl)); > + > /* First do indirect call promotion and early inline to make the > IR match the profiled binary before actual annotation. > > @@ -1497,48 +1533,17 @@ auto_profile (void) > early_inliner (); > } > > + early_inliner (); > autofdo::afdo_annotate_cfg (promoted_stmts); > compute_function_frequency (); > update_ssa (TODO_update_ssa); > - pop_cfun (); > - } > > - cgraph_pre_profiling_inlining_done = true; > - cgraph_process_module_scope_statics (); > - /* Now perform link to allow cross module inlining. */ > - cgraph_do_link (); > - varpool_do_link (); > - cgraph_unify_type_alias_sets (); > - > - FOR_EACH_FUNCTION (node) > - { > - if (!gimple_has_body_p (node->symbol.decl)) > - continue; > - > - /* Don't profile functions produced for builtin stuff. */ > - if (DECL_SOURCE_LOCATION (node->symbol.decl) == BUILTINS_LOCATION) > - continue; > - > - push_cfun (DECL_STRUCT_FUNCTION (node->symbol.decl)); > - > - if (L_IPO_COMP_MODE) > - { > - basic_block bb; > - FOR_EACH_BB (bb) > - { > - gimple_stmt_iterator gsi; > - for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) > - { > - gimple stmt = gsi_stmt (gsi); > - if (is_gimple_call (stmt)) > - lipo_fixup_cgraph_edge_call_target (stmt); > - } > - } > - } > /* Local pure-const may imply need to fixup the cfg. */ > if (execute_fixup_cfg () & TODO_cleanup_cfg) > cleanup_tree_cfg (); > > + free_dominance_info (CDI_DOMINATORS); > + free_dominance_info (CDI_POST_DOMINATORS); > rebuild_cgraph_edges (); > pop_cfun (); > }