On Sun, Dec 15, 2013 at 06:53:07PM +0100, Eric Botcazou wrote:
> 2013-12-15  Eric Botcazou  <ebotca...@adacore.com>
> 
>       PR debug/59418
>       * dwarf2cfi.c (dwarf2out_frame_debug_cfa_offset): Fix comment and clean 
>       up implementation.
>       (dwarf2out_frame_debug_cfa_restore): Handle TARGET_DWARF_REGISTER_SPAN.
>       (dwarf2out_frame_debug_expr): Clean up implementation.
> 
> 
> 2013-12-15  Eric Botcazou  <ebotca...@adacore.com>
> 
>       * gcc.dg/pr59418.c: New test.

> @@ -1149,18 +1149,14 @@ dwarf2out_frame_debug_cfa_offset (rtx se
>    else
>      {
>        /* We have a PARALLEL describing where the contents of SRC live.
> -      Queue register saves for each piece of the PARALLEL.  */
> -      int par_index;
> -      int limit;
> +      Adjust the offset for each piece of the PARALLEL.  */
>        HOST_WIDE_INT span_offset = offset;
>  
>        gcc_assert (GET_CODE (span) == PARALLEL);
>  
> -      limit = XVECLEN (span, 0);
> -      for (par_index = 0; par_index < limit; par_index++)
> +      for (int par_index = 0; par_index < XVECLEN (span, 0); par_index++)

Is it really a good idea to put the XVECLEN into the loop condition?
I mean, the functions that are called in the loop are unlikely pure
and thus the length will need to be uselessly reread for each iteration.

My preference would be to keep the limit hoisted manually before the loop.

>       {
>         /* We have a PARALLEL describing where the contents of SRC live.
>            Queue register saves for each piece of the PARALLEL.  */
> -       int par_index;
> -       int limit;
>         HOST_WIDE_INT span_offset = offset;
>  
>         gcc_assert (GET_CODE (span) == PARALLEL);
>  
> -       limit = XVECLEN (span, 0);
> -       for (par_index = 0; par_index < limit; par_index++)
> +       for (int par_index = 0; par_index < XVECLEN (span, 0); par_index++)

And here too.

Otherwise looks good to me.

        Jakub

Reply via email to