This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [GOOGLE] Fix a bug when profile propagation handles infinite loop.


What is the usual number of iterations?

David

On Fri, Oct 25, 2013 at 4:10 PM, Dehao Chen <dehao@google.com> wrote:
> If the propagation finds an infinite look, if the in-edge count is
> non-zero, then it will cause compiler go into infinite loop when
> building with AutoFDO.
>
> Bootstrapped and regression test on-going.
>
> OK for google-4_8 branch?
>
> Thanks,
> Dehao
>
> Index: gcc/auto-profile.c
> ===================================================================
> --- gcc/auto-profile.c (revision 204027)
> +++ gcc/auto-profile.c (working copy)
> @@ -1287,6 +1287,7 @@ afdo_propagate (void)
>  {
>    basic_block bb;
>    bool changed = true;
> +  int i = 0;
>
>    FOR_ALL_BB (bb)
>      {
> @@ -1295,7 +1296,7 @@ afdo_propagate (void)
>   bb->flags |= BB_ANNOTATED;
>      }
>
> -  while (changed)
> +  while (changed && i++ < PARAM_VALUE (PARAM_AUTOFDO_MAX_PROPAGATE_ITERATIONS))
>      {
>        changed = false;
>
> Index: gcc/params.def
> ===================================================================
> --- gcc/params.def (revision 204027)
> +++ gcc/params.def (working copy)
> @@ -460,6 +460,14 @@ DEFPARAM(PARAM_MAX_PREDICTED_ITERATIONS,
>   "The maximum number of loop iterations we predict statically",
>   100, 0, 0)
>
> +/* This parameter controls the maximum iterations that AutoFDO profile
> +   prpagation algorithm will run for a specific CFG.  */
> +
> +DEFPARAM(PARAM_AUTOFDO_MAX_PROPAGATE_ITERATIONS,
> +         "max-autofdo-max-propagate-iterations",
> +         "The maximum number of AutoFDO profile propagation iterations",
> +         1000, 0, 0)
> +
>  /* This parameter controls the probability of builtin_expect. The default
>     value is 90%. This empirical value is obtained through the weighted
>     probability of FDO counters (with the FDO count value as the weight)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]