[PING] Patch to implement "Switch statement fdo reordering"

Ralf Wildenhues Ralf.Wildenhues@gmx.de
Wed Aug 6 20:46:00 GMT 2008


Hello Edmar,

some really minor typo nits:

* Edmar Wienskoski wrote on Tue, Jul 15, 2008 at 09:07:08PM CEST:
> --- gcc/gcc/doc/invoke.texi	(revision 134561)
> +++ gcc/gcc/doc/invoke.texi	(working copy)
> @@ -6348,10 +6348,11 @@
>  optimization.  You must use @option{-fprofile-generate} both when
>  compiling and when linking your program.
>  
> -The following options are enabled: @code{-fprofile-arcs}, @code{-fprofile-values}, @code{-fvpt}.
> +The following options are enabled: @code{-fprofile-arcs}, @code{-fprofile-values},
> +@code{-fvpt}, @code{-fvpt-case-rebalance}.

Please put an "and" after the last comma.

> @@ -6359,8 +6360,9 @@
>  Enable profile feedback directed optimizations, and optimizations
>  generally profitable only with profile feedback available.
>  
> -The following options are enabled: @code{-fbranch-probabilities}, @code{-fvpt},
> -@code{-funroll-loops}, @code{-fpeel-loops}, @code{-ftracer}
> +The following options are enabled: @code{-fbranch-probabilities},
> +@code{-fvpt}, @code{-fvpt-case-rebalance}, @code{-funroll-loops},
> +@code{-fpeel-loops}, @code{-ftracer}

Likewise, and missing period at end of sentence.  I see that these
issues were present before your patch, so if you don't want to fix
them in this patch, that's fine too, I'll collect them in my next
cleanup patch then.

> @@ -6626,6 +6628,26 @@
>  Currently the optimizations include specialization of division operation
>  using the knowledge about the value of the denominator.
>  
> +@item -fvpt-case-rebalance
> +@opindex fvpt-case-rebalance
> +If combined with @option{-fvpt}, it instructs the compiler to add a code

Is it "to add a code" or "to add code" here?

> +to gather information about the condition expression of switch statements.
> +
> +It reads back the occurrence frequency of each case value, and
> +generate code for a switch statement from a binary tree weighted with

generates

> +those occurrence frequencies.

I wonder whether these two sentences could simply be in one paragraph
(i.e., without the empty line in between).  Likewise, the next three
sentences could be merged.  You could merge them if you agree.

> +This optimization is controlled by two parameters, which may be
> +specified individually by using @option{--param @var{name}=@var{value}}.
> +
> +The range of case values that are profiled is controlled by
> +@option{--param fdo-switch-histogram-size}.
> +
> +The minimum frequency of a default value to cause its promotion to a explicit
> +case label is controlled by @option{--param fdo-min-case-promotion-rate}.
> +
> +Enabled with @option{-fprofile-generate} and @option{-fprofile-use}.
> +
>  @item -frename-registers
>  @opindex frename-registers
>  Attempt to avoid false dependencies in scheduled code by making use
> @@ -7008,6 +7030,22 @@
>  @item lim-expensive
>  The minimum cost of an expensive expression in the loop invariant motion.
>  
> +@item fdo-switch-histogram-size
> +Defines the range of switch statement case values for which
> +frequency execution will be collected. Default value is 256.
> +
> +@item fdo-min-case-promotion-rate
> +Defines the minimum frequency for a switch statement default value
> +be promoted to a explicit case label.

an explicit case label

> +Normally, a binary search has to be exhausted before the code in the
> +default label can be executed. If a particular default value is found
> +to have a significant execution frequency, a new node is created in
> +the binary search tree with the frequency of that particular value
> +used as weight.
> +
> +The default value is 10 percent.
> +
>  @item iv-consider-all-candidates-bound
>  Bound on number of candidates for induction variables below that
>  all candidates are considered for each use in induction variable


> --- gcc/gcc/stmt.c	(revision 134561)
> +++ gcc/gcc/stmt.c	(working copy)

> @@ -2453,6 +2488,188 @@

> +	  /* Calculate the cost for each indiviual big/negative case */

individual

Cheers,
Ralf



More information about the Gcc-patches mailing list