From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 69484 invoked by alias); 26 Oct 2018 07:20:28 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 69469 invoked by uid 89); 26 Oct 2018 07:20:27 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 26 Oct 2018 07:20:26 +0000 Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 73D3EAEBD; Fri, 26 Oct 2018 07:20:24 +0000 (UTC) From: =?UTF-8?Q?Martin_Li=c5=a1ka?= Subject: [PATCH] Relax hash function to match equals function behavior (PR testsuite/86158). To: gcc-patches@gcc.gnu.org Cc: Jan Hubicka , Alexander Monakov Message-ID: Date: Fri, 26 Oct 2018 07:47:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------2871F701BB59614018BDF382" X-IsSubscribed: yes X-SW-Source: 2018-10/txt/msg01666.txt.bz2 This is a multi-part message in MIME format. --------------2871F701BB59614018BDF382 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-length: 885 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. Thanks, Martin gcc/ChangeLog: 2018-10-25 Martin Liska 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(-) --------------2871F701BB59614018BDF382 Content-Type: text/x-patch; name="0001-Relax-hash-function-to-match-equals-function-behavio.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-Relax-hash-function-to-match-equals-function-behavio.pa"; filename*1="tch" Content-length: 523 diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index 1e40997c92c..4bd0b4b4541 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -115,8 +115,8 @@ struct ipa_vr_ggc_hash_traits : public ggc_cache_remove { gcc_checking_assert (!p->equiv ()); inchash::hash hstate (p->kind ()); - hstate.add_ptr (p->min ()); - hstate.add_ptr (p->max ()); + inchash::add_expr (p->min (), hstate); + inchash::add_expr (p->max (), hstate); return hstate.end (); } static bool --------------2871F701BB59614018BDF382--