Fix hashing of multiply and add

Richard Biener richard.guenther@gmail.com
Mon Nov 9 12:27:57 GMT 2020


On Mon, Nov 9, 2020 at 11:39 AM Jan Hubicka <hubicka@ucw.cz> wrote:
>
> Hi,
> I have noticed that hash_operand computes a hash value that is unused
> since two is a local variable.  This patch fixes it.
>
> Bootstrapped/regtested x86_64-linux, OK?

OK.  You can add DOT_PROD_EXPR to the mix (or handle
commutative_ternary_tree_code generally).  All of those tree codes
will only appear "late".

>         * fold-const.c (operand_compare::hash_operand): Fix hashing of operand
>         3 of multiply and add.
> diff --git a/gcc/fold-const.c b/gcc/fold-const.c
> index c47557daeba..8844069127c 100644
> --- a/gcc/fold-const.c
> +++ b/gcc/fold-const.c
> @@ -3806,7 +3806,7 @@ operand_compare::hash_operand (const_tree t, inchash::hash &hstate,
>                 hash_operand (TREE_OPERAND (t, 0), one, flags);
>                 hash_operand (TREE_OPERAND (t, 1), two, flags);
>                 hstate.add_commutative (one, two);
> -               hash_operand (TREE_OPERAND (t, 2), two, flags);
> +               hash_operand (TREE_OPERAND (t, 2), hstate, flags);
>                 return;
>               }
>


More information about the Gcc-patches mailing list