Kael Andrew Alonzo Franco <[email protected]> writes:

> len is known to be 1 so return 1.
> Helps with speeding up C++ optimizers.
>
> Obvious fix so pushed.
>
> gcc/ChangeLog:
>
>       * wide-int.cc (canonize): Use return 1 instead of return len.
>
> Signed-off-by: Kael Andrew Franco <[email protected]>
> ---
>  gcc/wide-int.cc | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/gcc/wide-int.cc b/gcc/wide-int.cc
> index c2c424344a2..668b2e4ea7d 100644
> --- a/gcc/wide-int.cc
> +++ b/gcc/wide-int.cc
> @@ -90,7 +90,7 @@ canonize (HOST_WIDE_INT *val, unsigned int len, unsigned 
> int precision)
>      len = blocks_needed;
>  
>    if (len == 1)
> -    return len;
> +    return 1;

Does this really make a difference you can observe in any benchmark?
Which pass cleans up 'return len' and is it really late? It should be
done quite early.

(I also personally don't see it as an improvement, and could easily see
someone submitting the opposite change given you have a repetition of
the constant.)

>  
>    top = val[len - 1];
>    if (len * HOST_BITS_PER_WIDE_INT > precision)

sam

Attachment: signature.asc
Description: PGP signature

Reply via email to