From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by sourceware.org (Postfix) with ESMTPS id 4BBBF385840D for ; Mon, 26 Jun 2023 16:40:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4BBBF385840D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=suse.cz Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 684011F7AB; Mon, 26 Jun 2023 16:40:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1687797634; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=HIPU9m1mKoK++tEtslWWZl+u8TS8djxbhX5tzQy/x3A=; b=L+i+GDKya8Oq3i11FPeqxRW1LVvd4KzspTAnw7yeLRQ4qW2M2PVCWN6bp90xTGVQpO4SV3 9JbP2EJAuWb1f6l1AhEQXIfLruVPEpcGTGfCWEKNatPkcL7UiyLlh+8dWZV5r/IoTgIJt/ /OKoGNqDXlfTjzbN5CwqmPAKL2YDVpQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1687797634; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=HIPU9m1mKoK++tEtslWWZl+u8TS8djxbhX5tzQy/x3A=; b=qNvGB1bXc/QjRGchlaw8qy+hy4/WCDN+bRFDr6JYZaLoY3BeAFIqLeUzMIRe5csy+mvVhB yhjl5XxxAMpxTDBw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 5C47813905; Mon, 26 Jun 2023 16:40:34 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 15mAFoK/mWQtRwAAMHmgww (envelope-from ); Mon, 26 Jun 2023 16:40:34 +0000 From: Martin Jambor To: Aldy Hernandez via Gcc-patches , GCC patches Cc: Andrew MacLeod , Aldy Hernandez , Jan Hubicka Subject: Re: [PATCH] Implement ipa_vr hashing. In-Reply-To: <20230522185622.537454-2-aldyh@redhat.com> References: <20230522185622.537454-1-aldyh@redhat.com> <20230522185622.537454-2-aldyh@redhat.com> User-Agent: Notmuch/0.37 (https://notmuchmail.org) Emacs/28.2 (x86_64-suse-linux-gnu) Date: Mon, 26 Jun 2023 18:40:33 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-10.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,SPF_HELO_NONE,SPF_SOFTFAIL,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi, On Mon, May 22 2023, Aldy Hernandez via Gcc-patches wrote: > Implement hashing for ipa_vr. When all is said and done, all these > patches incurr a 7.64% slowdown for ipa-cp, with is entirely covered by > the similar 7% increase in this area last week. So we get type agnostic > ranges with "infinite" range precision close to free. > > There is no change in overall compilation. > > OK? > One small request.... > gcc/ChangeLog: > > * ipa-prop.cc (struct ipa_vr_ggc_hash_traits): Adjust for use with > ipa_vr instead of value_range. > (gt_pch_nx): Same. > (gt_ggc_mx): Same. > (ipa_get_value_range): Same. > * value-range.cc (gt_pch_nx): Move to ipa-prop.cc and adjust for > ipa_vr. > (gt_ggc_mx): Same. > --- > gcc/ipa-prop.cc | 76 +++++++++++++++++++++++++++------------------- > gcc/value-range.cc | 15 --------- > 2 files changed, 45 insertions(+), 46 deletions(-) > > diff --git a/gcc/ipa-prop.cc b/gcc/ipa-prop.cc > index c46a89f1b49..6383bc11e0a 100644 > --- a/gcc/ipa-prop.cc > +++ b/gcc/ipa-prop.cc > @@ -109,53 +109,53 @@ struct ipa_bit_ggc_hash_traits : public ggc_cache_remove > /* Hash table for avoid repeated allocations of equal ipa_bits. */ > static GTY ((cache)) hash_table *ipa_bits_hash_table; > > -/* Traits for a hash table for reusing value_ranges used for IPA. Note that > - the equiv bitmap is not hashed and is expected to be NULL. */ > +/* Traits for a hash table for reusing ranges. */ > > -struct ipa_vr_ggc_hash_traits : public ggc_cache_remove > +struct ipa_vr_ggc_hash_traits : public ggc_cache_remove > { > - typedef value_range *value_type; > - typedef value_range *compare_type; > + typedef ipa_vr *value_type; > + typedef const vrange *compare_type; > static hashval_t > - hash (const value_range *p) > + hash (const ipa_vr *p) > { > - tree min, max; > - value_range_kind kind = get_legacy_range (*p, min, max); > - inchash::hash hstate (kind); > - inchash::add_expr (min, hstate); > - inchash::add_expr (max, hstate); > + // This never get called, except in the verification code, as > + // ipa_get_value_range() calculates the hash itself. This > + // function is mostly here for completness' sake. > + Value_Range vr; > + p->get_vrange (vr); > + inchash::hash hstate; > + add_vrange (vr, hstate); > return hstate.end (); > } > static bool > - equal (const value_range *a, const value_range *b) > + equal (const ipa_vr *a, const vrange *b) > { > - return (types_compatible_p (a->type (), b->type ()) > - && *a == *b); > + return a->equal_p (*b); > } > static const bool empty_zero_p = true; > static void > - mark_empty (value_range *&p) > + mark_empty (ipa_vr *&p) > { > p = NULL; > } > static bool > - is_empty (const value_range *p) > + is_empty (const ipa_vr *p) > { > return p == NULL; > } > static bool > - is_deleted (const value_range *p) > + is_deleted (const ipa_vr *p) > { > - return p == reinterpret_cast (1); > + return p == reinterpret_cast (1); > } > static void > - mark_deleted (value_range *&p) > + mark_deleted (ipa_vr *&p) > { > - p = reinterpret_cast (1); > + p = reinterpret_cast (1); > } > }; > > -/* Hash table for avoid repeated allocations of equal value_ranges. */ > +/* Hash table for avoid repeated allocations of equal ranges. */ > static GTY ((cache)) hash_table *ipa_vr_hash_table; > > /* Holders of ipa cgraph hooks: */ > @@ -265,6 +265,22 @@ ipa_vr::dump (FILE *out) const > fprintf (out, "NO RANGE"); > } > > +// ?? These stubs are because we use an ipa_vr in a hash_traits and > +// hash-traits.h defines an extern of gt_ggc_mx (T &) instead of > +// picking up the gt_ggc_mx (T *) version. If you mean FIXME or TODO, please replace the "??" string with one of those. Otherwise please just remove it or specify what you mean in some clearer way. OK with that change. Thanks, Martin > +void > +gt_pch_nx (ipa_vr *&x) > +{ > + return gt_pch_nx ((ipa_vr *) x); > +} > + > +void > +gt_ggc_mx (ipa_vr *&x) > +{ > + return gt_ggc_mx ((ipa_vr *) x); > +} > + > + [...]