Hi, This patch changes the default lipo module grouping algorithm from algoritm 0 (eager propagation algorithm) to algorith 1 (inclusion_based priority algorithm).
It also changes the name __gcov_lipo_strict_inclusion to __gcov_lipo_weak_inclusion and the default is 0. Tested with google internal benchmarks. -Rong 2013-03-05 Rong Xu <x...@google.com> * libgcc/dyn-ipa.c (__gcov_lipo_weak_inclusion): changed from __gcov_lipo_strict_inclusion. (init_dyn_call_graph): Ditto. (ps_add_auxiliary): Ditto. (modu_edge_add_auxiliary): Ditto. * gcc/tree-profile.c (tree_init_dyn_ipa_parameters): Ditto. * gcc/params.def (PARAM_LIPO_GROUPING_ALGORITHM): Changed default value from 0 to 1. Index: libgcc/dyn-ipa.c =================================================================== --- libgcc/dyn-ipa.c (revision 196405) +++ libgcc/dyn-ipa.c (working copy) @@ -157,7 +157,7 @@ extern gcov_unsigned_t __gcov_lipo_dump_cgraph; extern gcov_unsigned_t __gcov_lipo_max_mem; extern gcov_unsigned_t __gcov_lipo_grouping_algorithm; extern gcov_unsigned_t __gcov_lipo_merge_modu_edges; -extern gcov_unsigned_t __gcov_lipo_strict_inclusion; +extern gcov_unsigned_t __gcov_lipo_weak_inclusion; #if defined(inhibit_libc) __gcov_build_callgraph (void) {} @@ -195,7 +195,7 @@ enum GROUPING_ALGORITHM }; static int flag_alg_mode; static int flag_modu_merge_edges; -static int flag_strict_inclusion; +static int flag_weak_inclusion; static gcov_unsigned_t mem_threshold; /* Returns 0 if no dump is enabled. Returns 1 if text form graph @@ -387,7 +387,7 @@ init_dyn_call_graph (void) flag_alg_mode = __gcov_lipo_grouping_algorithm; flag_modu_merge_edges = __gcov_lipo_merge_modu_edges; - flag_strict_inclusion = __gcov_lipo_strict_inclusion; + flag_weak_inclusion = __gcov_lipo_weak_inclusion; mem_threshold = __gcov_lipo_max_mem * 1.25; gi_ptr = __gcov_list; @@ -417,13 +417,13 @@ init_dyn_call_graph (void) if ((env_str = getenv ("GCOV_DYN_MERGE_EDGES"))) flag_modu_merge_edges = atoi (env_str); - if ((env_str = getenv ("GCOV_DYN_STRICT_INCLUSION"))) - flag_strict_inclusion = atoi (env_str); + if ((env_str = getenv ("GCOV_DYN_WEAK_INCLUSION"))) + flag_weak_inclusion = atoi (env_str); if (do_dump) fprintf (stderr, - "!!!! Using ALG=%d merge_edges=%d strict_inclusion=%d. \n", - flag_alg_mode, flag_modu_merge_edges, flag_strict_inclusion); + "!!!! Using ALG=%d merge_edges=%d weak_inclusion=%d. \n", + flag_alg_mode, flag_modu_merge_edges, flag_weak_inclusion); } if (do_dump) @@ -1809,7 +1809,7 @@ ps_add_auxiliary (const void *value, int not_safe_to_insert = *(int *) data3; gcov_unsigned_t new_ggc_size; - /* For strict incluesion, we know it's safe to insert. */ + /* For strict inclusion, we know it's safe to insert. */ if (!not_safe_to_insert) { modu_add_auxiliary (m_id, s_m_id, *(gcov_type*)data2); @@ -1825,7 +1825,8 @@ ps_add_auxiliary (const void *value, return 1; } -/* return 1 if insertion happened, otherwise 0. */ +/* Return 1 if insertion happened, otherwise 0. */ + static int modu_edge_add_auxiliary (struct modu_edge *edge) { @@ -1871,7 +1872,7 @@ modu_edge_add_auxiliary (struct modu_edge *edge) { pointer_set_traverse (node_exported_to, ps_check_ggc_mem, &callee_m_id, &fail, 0); - if (fail && flag_strict_inclusion) + if (fail && !flag_weak_inclusion) return 0; } Index: gcc/tree-profile.c =================================================================== --- gcc/tree-profile.c (revision 196471) +++ gcc/tree-profile.c (working copy) @@ -389,10 +389,10 @@ tree_init_dyn_ipa_parameters (void) gcov_lipo_strict_inclusion = build_decl ( UNKNOWN_LOCATION, VAR_DECL, - get_identifier ("__gcov_lipo_strict_inclusion"), + get_identifier ("__gcov_lipo_weak_inclusion"), get_gcov_unsigned_t ()); init_comdat_decl (gcov_lipo_strict_inclusion, - PARAM_LIPO_STRICT_INCLUSION); + PARAM_LIPO_WEAK_INCLUSION); } } Index: gcc/params.def =================================================================== --- gcc/params.def (revision 196471) +++ gcc/params.def (working copy) @@ -1018,25 +1018,26 @@ DEFPARAM (PARAM_INLINE_DUMP_MODULE_ID, LIPO profile-gen. */ DEFPARAM (PARAM_LIPO_GROUPING_ALGORITHM, "lipo-grouping-algorithm", - "Default is 0 which is the eager propagation algorithm." - "If the value is 1, use the inclusion_based priority algorithm.", - 0, 0, 1) + "Algorithm 0 uses the eager propagation algorithm." + "Algorithm 1 uses the inclusion_based priority algorithm." + "The default algorithm is 1.", + 1, 0, 1) /* In the inclusion_based_priority grouping algorithm, specify if we combine the the edges b/w modules. */ DEFPARAM (PARAM_LIPO_MERGE_MODU_EDGES, "lipo-merge-modu-edges", "Default is 0 which not merge." - "If the value is 1, merge the edges.", + "If the value is 1, merge the edges.", 0, 0, 1) /* In the inclusion_based_priority grouping algorithm, specify if we force strict inclusion of modules. */ -DEFPARAM (PARAM_LIPO_STRICT_INCLUSION, - "lipo-strict-inclusion", - "0: not strict inclusion; 1: force strict inclusion." - "Default is 1.", - 1, 0, 1) +DEFPARAM (PARAM_LIPO_WEAK_INCLUSION, + "lipo-weak-inclusion", + "0: force strict inclusion; 1: weak inclusion." + "Default is 0.", + 0, 0, 1) /* In LIPO profile-gen, use this parameter to enable cgraph dumping. */ DEFPARAM (PARAM_LIPO_DUMP_CGRAPH, -- This patch is available for review at http://codereview.appspot.com/7490043