This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Relax hash function to match equals function behavior (PR testsuite/86158).


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(-)
>
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]