This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Relax hash function to match equals function behavior (PR testsuite/86158).
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Martin Liška <mliska at suse dot cz>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Jan Hubicka <hubicka at ucw dot cz>, Alexander Monakov <amonakov at ispras dot ru>
- Date: Fri, 26 Oct 2018 10:56:45 +0200
- Subject: Re: [PATCH] Relax hash function to match equals function behavior (PR testsuite/86158).
- References: <fc8fd142-f645-4071-0ce0-a997442f18e0@suse.cz>
On Fri, Oct 26, 2018 at 9:20 AM Martin Liška <mliska@suse.cz> wrote:
>
> Hi.
>
> The patch aligns ipa_vr_ggc_hash_traits::hash function what actual ipa_vr_ggc_hash_traits::equals
> operator does. Currently, the hash function is pointer based, which the real equal operator
> does internally operand_equal_p, which works fine for equal constants (with different addresses).
>
> It's tested on ppcl64-linux-gnu and it's pre-approved by Honza.
>
> Alexander:
> Note that I'm planning to come up with an equivalent of qsort_chk for hash tables.
> Correct me if I'm wrong but it's expected that when equals function returns true
> to have equal hash values as well? If so, that would catch this case I'm patching.
Yes. See for example operand_equal_p () where we do such check.
Richard.
> Thanks,
> Martin
>
> gcc/ChangeLog:
>
> 2018-10-25 Martin Liska <mliska@suse.cz>
>
> PR testsuite/86158
> * ipa-prop.c (struct ipa_vr_ggc_hash_traits): Hash with
> addr_expr and not with pointers.
> ---
> gcc/ipa-prop.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
>