Re: [PATCH] wide-int: Use return 1 instead of return len.

Sam James <[email protected]>
Newsgroups gmane.comp.gcc.patches
Organization Gentoo
Message-ID <[email protected]>
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
signature.asc (application/pgp-signature, 418 B)
-----BEGIN PGP SIGNATURE-----

iQEBBAEWCgCpFiEEJaa7iN2bdkxrVUHCc4QJ9SDfkZAFAmp6RqQbFIAAAAAABAAO
bWFudTIsMi41KzEuMTIsMiwyXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25z
Lm9wZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQyNUE2QkI4OEREOUI3NjRDNkI1NTQx
QzI3Mzg0MDlGNTIwREY5MTkwDxxzYW1AZ2VudG9vLm9yZwAKCRBzhAn1IN+RkK3L
AQDsnETVg2YmK3kqDu3gfoOFdPBv1s+LKwwqplb8N+Y9swEAlGUDm9jVQMdzJYKg
GOO0yFhYD+3laztSmAIx191NtgY=
=fV6Y
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.