> diff --git a/gcc/ChangeLog b/gcc/ChangeLog
> index 5cb07b7..754f882 100644
> --- a/gcc/ChangeLog
> +++ b/gcc/ChangeLog
> @@ -1,3 +1,13 @@
> +2013-11-17  Martin Liska  <marxin.li...@gmail.com>
> +         Jan Hubicka  <j...@suse.cz>
> +
> +     * cgraphunit.c (node_cmp): New function.
> +     (expand_all_functions): Function ordering added.
> +     * common.opt: New profile based function reordering flag introduced.
> +     * lto-partition.c: Support for time profile added.
> +     * lto.c: Likewise.
> +     * predict.c (handle_missing_profiles): Time profile handled in
> +       missing profiles.

OK.
> @@ -8933,6 +8933,14 @@ from profiling values of expressions for usage in 
> optimizations.
>  
>  Enabled with @option{-fprofile-generate} and @option{-fprofile-use}.
>  
> +@item -fprofile-reoder-functions
> +@opindex fprofile-reorder-functions
> +Function reordering based on profile instrumentation collects
> +first time of execution of a function and orders these functions
> +in ascending order.
> +
> +Enabled with @option{-fprofile-generate} and @option{-fprofile-use}.

I wonder if we don't want to enable it only for -fprofile-use -flto.
You do not need to enable it -fprofile-generate.
> --- a/gcc/opts.c
> +++ b/gcc/opts.c
> @@ -1690,6 +1690,8 @@ common_handle_option (struct gcc_options *opts,
>       opts->x_flag_vect_cost_model = VECT_COST_MODEL_DYNAMIC;
>        if (!opts_set->x_flag_tree_loop_distribute_patterns)
>       opts->x_flag_tree_loop_distribute_patterns = value;
> +      if (!opts_set->x_flag_profile_reorder_functions)
> +     opts->x_flag_profile_reorder_functions = value;
>        /* Indirect call profiling should do all useful transformations
>        speculative devirutalization does.  */
>        if (!opts_set->x_flag_devirtualize_speculatively
> @@ -1708,6 +1710,8 @@ common_handle_option (struct gcc_options *opts,
>       opts->x_flag_profile_values = value;
>        if (!opts_set->x_flag_inline_functions)
>       opts->x_flag_inline_functions = value;
> +      if (!opts_set->x_flag_profile_reorder_functions)
> +     opts->x_flag_profile_reorder_functions = value;
>        /* FIXME: Instrumentation we insert makes ipa-reference bitmaps
>        quadratic.  Disable the pass until better memory representation
>        is done.  */

Rmove the -fprofile-generate path here.
> +
> +      /* If time profile is missing, let assign the maximum that comes from
> +      caller functions.  */
> +      if (!node->tp_first_run)
> +     node->tp_first_run = max_tp_first_run;

                        Probably +1 here, you want the function to appar 
afterwards.

Honza
> +
>        if (call_count
>            && fn && fn->cfg
>            && (call_count * unlikely_count_fraction >= profile_info->runs))

Reply via email to