From patchwork Tue Jan 14 04:51:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: David Malcolm X-Patchwork-Id: 1222460 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-517321-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha1 header.s=default header.b=M4K63m+6; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=cOQM1MAr; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47xdZ75BKnz9sQp for ; Tue, 14 Jan 2020 16:00:30 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; q=dns; s= default; b=NWq6/FOthKrECbwjfMgwYKp392IXy1R5kKbPIx52kKd8DKGbHpSc1 ygENRhc22vs2VJUWe4msAWC4Y6amg3NhybX0+MI82dcumtlboDGdCQhZIcKex4CF 8UwInocHRC6AwmNzyCXNBNlOZNJh+e7Jpe/HI6U78NXg4eOzk86HzY= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; s=default; bh=nf7tj7ckoXkgJGus6CE/wHmMk/Q=; b=M4K63m+6IYoimJaybVVrpEej549e +wI7rM+m7IriBOiRxGUvzPmOQJnsEwVAHmcWVKVaUN5NuUcZHVX5GgaK4zSwE/pp O7jbOX7E8roA3z+Nc5TOPrLi3v1H3f1si2sjtRd+CJm8QzlJba1UGekR5G/W+P39 QOjfqpdy5MdOoYU= Received: (qmail 102926 invoked by alias); 14 Jan 2020 04:52:16 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 102864 invoked by uid 89); 14 Jan 2020 04:52:16 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-23.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: us-smtp-delivery-1.mimecast.com Received: from us-smtp-2.mimecast.com (HELO us-smtp-delivery-1.mimecast.com) (205.139.110.61) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 14 Jan 2020 04:52:12 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578977531; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DMP8qDi6A5yc5mif08pbhs+qGpqlwKWtyGbY5vfB3FQ=; b=cOQM1MArESk4783xWo+C3yGz/30vm+Z4UPM2CDEzjXMaYCNr2d0i0QACl7hE0YBjSPNknO eqXtWRvzFuLDp9SzXNItgsAR8Y6sx2MgrUabzKuWcFkkzhjno3lEzr0NNdx4nWurwvp8El QKX6lOuOzGYrWnzEcU7ZRqsQ7CSO8a0= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-62-eMr4ESD_OCickgAgLzkaNg-1; Mon, 13 Jan 2020 23:52:06 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 742B6477; Tue, 14 Jan 2020 04:52:05 +0000 (UTC) Received: from t470.redhat.com (ovpn-117-41.phx2.redhat.com [10.3.117.41]) by smtp.corp.redhat.com (Postfix) with ESMTP id 93F265DA32; Tue, 14 Jan 2020 04:52:04 +0000 (UTC) From: David Malcolm To: Jakub Jelinek Cc: law@redhat.com, Richard Biener , gcc-patches@gcc.gnu.org, David Malcolm Subject: [PATCH 1/2] hash-table.h: support non-zero empty values in empty_slow (v2) Date: Mon, 13 Jan 2020 23:51:53 -0500 Message-Id: <20200114045154.19021-1-dmalcolm@redhat.com> In-Reply-To: <10454af11705eee5ca86ca83d351e81e04d6fc45.camel@redhat.com> References: <10454af11705eee5ca86ca83d351e81e04d6fc45.camel@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-IsSubscribed: yes On Mon, 2020-01-13 at 21:58 -0500, David Malcolm wrote: > On Tue, 2020-01-14 at 00:55 +0100, Jakub Jelinek wrote: > > On Mon, Jan 13, 2020 at 06:42:06PM -0500, David Malcolm wrote: > > > Thanks. Does it have warnings, though? > > > > > > My attempt was similar, but ran into warnings from -Wclass- > > > memaccess in > > > four places, like this: > > > > > > ../../src/gcc/hash-map-traits.h:102:12: warning: ‘void* > > > memset(void*, > > > int, size_t)’ clearing an object of type ‘struct > > > hash_map > > std::pair >::hash_entry’ with no trivial > > > copy- > > > assignment; use assignment or value-initialization instead [- > > > Wclass- > > > memaccess] > > > 102 | memset (entry, 0, sizeof (T) * count); > > > | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > > > > where the types in question are: > > > > > > (1) > > > struct hash_map > > > > ::hash_entry > > > ../../src/gcc/tree-data-ref.c:844:17: required from here > > > > I don't understand how there could be new warnings. > > The patch doesn't add any new memsets, all it does is if (0) code > > in > > alloc_entries for certain traits and in empty_slow stops using > > memset > > for some traits and uses mark_empty loop there instead. > > Your patch didn't add new memsets; mine did - clearly I misspoke when > saying they were similar, mine had a somewhat different approach. > > Sorry for the noise, and thanks for your patch. > > I've extended your patch to cover the various hash traits in the > analyzer and it passes the analyzer's tests. I also added in the > selftests from my older patch. > > I examined the generated code, and it seems correct: > > * cfg.s correctly has a call to memset (even with no optimization) > for > hash_table::empty_slow > > * the hash_map example with nonzero empty for the analyzer: > analyzer/program-state.s: sm_state_map::remap_svalue_ids: hash_map > map_t; correctly shows a loop of calls to > mark_empty > > * a hash_map example with zero empty: tree-ssa.s edge_var_maps > correctly has a memset in the empty_slow, even with no optimization. > > ...which is promising. > > > For the graphite case, I wondered what happens if both is_empty and > is_deleted are true; looking at hash-table.h, sometimes one is > checked > first, sometimes the other, but I don't think it matters for this > case:; you have empty_zero_p = false,so it uses mark_empty, rather > than > trying to memset, which is correct - empty_zero_p being true can be > thought of as a "it is safe to optimize this hash_table/hash_map by > treating empty slots as all zero", if you will. > > > I'm trying a bootstrap build and full regression suite now, for all > languages (with graphite enabled, I believe). Will post the patches > if > it succeeds... > > > This was non-bootstrapped build, but I didn't see new warnings in > > there, > > and for tree-data-ref.c which you've mentioned I've tried to > > compile > > with installed trunk compiler and didn't get any warnings either. > > > > Jakub > > Thanks! Sorry again about getting this wrong. > > Dave Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu (in conjuction with the analyzer patch kit, which it fixes) OK for master? gcc/cp/ChangeLog: Jakub Jelinek * cp-gimplify.c (source_location_table_entry_hash::empty_zero_p): New static constant. * cp-tree.h (named_decl_hash::empty_zero_p): Likewise. (struct named_label_hash::empty_zero_p): Likewise. * decl2.c (mangled_decl_hash::empty_zero_p): Likewise. gcc/ChangeLog: Jakub Jelinek , David Malcolm * attribs.c (excl_hash_traits::empty_zero_p): New static constant. * gcov.c (function_start_pair_hash::empty_zero_p): Likewise. * graphite.c (struct sese_scev_hash::empty_zero_p): Likewise. * hash-map-tests.c (selftest::test_nonzero_empty_key): New selftest. (selftest::hash_map_tests_c_tests): Call it. * hash-map-traits.h (simple_hashmap_traits::empty_zero_p): New static constant, using the value of = H::empty_zero_p. (unbounded_hashmap_traits::empty_zero_p): Likewise, using the value from default_hash_traits . * hash-map.h (hash_map::empty_zero_p): Likewise, using the value from Traits. * hash-set-tests.c (value_hash_traits::empty_zero_p): Likewise. * hash-table.h (hash_table::alloc_entries): Guard the loop of calls to mark_empty with !Descriptor::empty_zero_p. (hash_table::empty_slow): Conditionalize the memset call with a check that Descriptor::empty_zero_p; otherwise, loop through the entries calling mark_empty on them. * hash-traits.h (int_hash::empty_zero_p): New static constant. (pointer_hash::empty_zero_p): Likewise. (pair_hash::empty_zero_p): Likewise. * ipa-devirt.c (default_hash_traits ::empty_zero_p): Likewise. * ipa-prop.c (ipa_bit_ggc_hash_traits::empty_zero_p): Likewise. (ipa_vr_ggc_hash_traits::empty_zero_p): Likewise. * profile.c (location_triplet_hash::empty_zero_p): Likewise. * sanopt.c (sanopt_tree_triplet_hash::empty_zero_p): Likewise. (sanopt_tree_couple_hash::empty_zero_p): Likewise. * tree-hasher.h (int_tree_hasher::empty_zero_p): Likewise. * tree-ssa-sccvn.c (vn_ssa_aux_hasher::empty_zero_p): Likewise. * tree-vect-slp.c (bst_traits::empty_zero_p): Likewise. * tree-vectorizer.h (default_hash_traits::empty_zero_p): Likewise. --- gcc/attribs.c | 2 ++ gcc/cp/cp-gimplify.c | 2 ++ gcc/cp/cp-tree.h | 2 ++ gcc/cp/decl2.c | 1 + gcc/gcov.c | 2 ++ gcc/graphite.c | 1 + gcc/hash-map-tests.c | 22 ++++++++++++++++++++++ gcc/hash-map-traits.h | 2 ++ gcc/hash-map.h | 1 + gcc/hash-set-tests.c | 2 ++ gcc/hash-table.h | 10 +++++++--- gcc/hash-traits.h | 3 +++ gcc/ipa-devirt.c | 1 + gcc/ipa-prop.c | 2 ++ gcc/profile.c | 2 ++ gcc/sanopt.c | 4 ++++ gcc/tree-hasher.h | 1 + gcc/tree-ssa-sccvn.c | 1 + gcc/tree-vect-slp.c | 1 + gcc/tree-vectorizer.h | 2 ++ 20 files changed, 61 insertions(+), 3 deletions(-) diff --git a/gcc/attribs.c b/gcc/attribs.c index ca89443eb3e..c66d4ae2c06 100644 --- a/gcc/attribs.c +++ b/gcc/attribs.c @@ -2048,6 +2048,8 @@ struct excl_hash_traits: typed_noop_remove x = value_type (NULL, NULL); } + static const bool empty_zero_p = false; + static void mark_empty (value_type &x) { x = value_type ("", ""); diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c index 827d240d11a..f401fe93fea 100644 --- a/gcc/cp/cp-gimplify.c +++ b/gcc/cp/cp-gimplify.c @@ -3043,6 +3043,8 @@ struct source_location_table_entry_hash ref.var = NULL_TREE; } + static const bool empty_zero_p = true; + static void mark_empty (source_location_table_entry &ref) { diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 98572bdbad1..c3ca4c8dace 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -900,6 +900,7 @@ struct named_decl_hash : ggc_remove inline static hashval_t hash (const value_type decl); inline static bool equal (const value_type existing, compare_type candidate); + static const bool empty_zero_p = true; static inline void mark_empty (value_type &p) {p = NULL_TREE;} static inline bool is_empty (value_type p) {return !p;} @@ -1870,6 +1871,7 @@ struct named_label_hash : ggc_remove inline static hashval_t hash (value_type); inline static bool equal (const value_type, compare_type); + static const bool empty_zero_p = true; inline static void mark_empty (value_type &p) {p = NULL;} inline static bool is_empty (value_type p) {return !p;} diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index a641667991f..042d6fa12df 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -120,6 +120,7 @@ struct mangled_decl_hash : ggc_remove return candidate == name; } + static const bool empty_zero_p = true; static inline void mark_empty (value_type &p) {p = NULL_TREE;} static inline bool is_empty (value_type p) {return !p;} diff --git a/gcc/gcov.c b/gcc/gcov.c index 1dca3049777..a291bac3e9e 100644 --- a/gcc/gcov.c +++ b/gcc/gcov.c @@ -1225,6 +1225,8 @@ struct function_start_pair_hash : typed_noop_remove ref.start_line = ~1U; } + static const bool empty_zero_p = false; + static void mark_empty (function_start &ref) { diff --git a/gcc/graphite.c b/gcc/graphite.c index 0ac46766b15..27f1e486e1f 100644 --- a/gcc/graphite.c +++ b/gcc/graphite.c @@ -233,6 +233,7 @@ struct sese_scev_hash : typed_noop_remove && operand_equal_p (key1.expr, key2.expr, 0)); } static void mark_deleted (seir_cache_key &key) { key.expr = NULL_TREE; } + static const bool empty_zero_p = false; static void mark_empty (seir_cache_key &key) { key.entry_dest = 0; } static bool is_deleted (const seir_cache_key &key) { return !key.expr; } static bool is_empty (const seir_cache_key &key) { return key.entry_dest == 0; } diff --git a/gcc/hash-map-tests.c b/gcc/hash-map-tests.c index 743fb26d571..63574029065 100644 --- a/gcc/hash-map-tests.c +++ b/gcc/hash-map-tests.c @@ -280,6 +280,27 @@ test_map_of_type_with_ctor_and_dtor () } } +/* Test calling empty on a hash_map that has a key type with non-zero + "empty" value. */ + +static void +test_nonzero_empty_key () +{ + typedef int_hash IntHash; + hash_map > x; + + for (int i = 1; i != 32; ++i) + x.put (i, i); + + ASSERT_EQ (x.get (0), NULL); + ASSERT_EQ (*x.get (1), 1); + + x.empty (); + + ASSERT_EQ (x.get (0), NULL); + ASSERT_EQ (x.get (1), NULL); +} + /* Run all of the selftests within this file. */ void @@ -288,6 +309,7 @@ hash_map_tests_c_tests () test_map_of_strings_to_int (); test_map_of_int_to_strings (); test_map_of_type_with_ctor_and_dtor (); + test_nonzero_empty_key (); } } // namespace selftest diff --git a/gcc/hash-map-traits.h b/gcc/hash-map-traits.h index 4764380b364..3b16be35f7d 100644 --- a/gcc/hash-map-traits.h +++ b/gcc/hash-map-traits.h @@ -36,6 +36,7 @@ struct simple_hashmap_traits static inline hashval_t hash (const key_type &); static inline bool equal_keys (const key_type &, const key_type &); template static inline void remove (T &); + static const bool empty_zero_p = H::empty_zero_p; template static inline bool is_empty (const T &); template static inline bool is_deleted (const T &); template static inline void mark_empty (T &); @@ -113,6 +114,7 @@ template struct unbounded_hashmap_traits { template static inline void remove (T &); + static const bool empty_zero_p = default_hash_traits ::empty_zero_p; template static inline bool is_empty (const T &); template static inline bool is_deleted (const T &); template static inline void mark_empty (T &); diff --git a/gcc/hash-map.h b/gcc/hash-map.h index 7cb466767ea..5b8fd184e32 100644 --- a/gcc/hash-map.h +++ b/gcc/hash-map.h @@ -66,6 +66,7 @@ class GTY((user)) hash_map return Traits::is_deleted (e); } + static const bool empty_zero_p = Traits::empty_zero_p; static void mark_empty (hash_entry &e) { Traits::mark_empty (e); } static bool is_empty (const hash_entry &e) { return Traits::is_empty (e); } diff --git a/gcc/hash-set-tests.c b/gcc/hash-set-tests.c index 696e35e9be0..bb32094be20 100644 --- a/gcc/hash-set-tests.c +++ b/gcc/hash-set-tests.c @@ -199,6 +199,8 @@ struct value_hash_traits: int_hash base_type::mark_deleted (v.val); } + static const bool empty_zero_p = false; + static void mark_empty (value_type &v) { base_type::mark_empty (v.val); diff --git a/gcc/hash-table.h b/gcc/hash-table.h index e0ddac5f578..a1423c78112 100644 --- a/gcc/hash-table.h +++ b/gcc/hash-table.h @@ -713,8 +713,9 @@ hash_table (n PASS_MEM_STAT); gcc_assert (nentries != NULL); - for (size_t i = 0; i < n; i++) - mark_empty (nentries[i]); + if (!Descriptor::empty_zero_p) + for (size_t i = 0; i < n; i++) + mark_empty (nentries[i]); return nentries; } @@ -867,8 +868,11 @@ hash_table::empty_slow () m_size = nsize; m_size_prime_index = nindex; } - else + else if (Descriptor::empty_zero_p) memset ((void *) entries, 0, size * sizeof (value_type)); + else + for (size_t i = 0; i < size; i++) + mark_empty (entries[i]); m_n_deleted = 0; m_n_elements = 0; diff --git a/gcc/hash-traits.h b/gcc/hash-traits.h index d259a41a418..3bca74c56ea 100644 --- a/gcc/hash-traits.h +++ b/gcc/hash-traits.h @@ -88,6 +88,7 @@ struct int_hash : typed_noop_remove static inline hashval_t hash (value_type); static inline bool equal (value_type existing, value_type candidate); static inline void mark_deleted (Type &); + static const bool empty_zero_p = Empty == 0; static inline void mark_empty (Type &); static inline bool is_deleted (Type); static inline bool is_empty (Type); @@ -150,6 +151,7 @@ struct pointer_hash static inline bool equal (const value_type &existing, const compare_type &candidate); static inline void mark_deleted (Type *&); + static const bool empty_zero_p = true; static inline void mark_empty (Type *&); static inline bool is_deleted (Type *); static inline bool is_empty (Type *); @@ -323,6 +325,7 @@ struct pair_hash static inline bool equal (const value_type &, const compare_type &); static inline void remove (value_type &); static inline void mark_deleted (value_type &); + static const bool empty_zero_p = T1::empty_zero_p; static inline void mark_empty (value_type &); static inline bool is_deleted (const value_type &); static inline bool is_empty (const value_type &); diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c index b888186134c..f0031957375 100644 --- a/gcc/ipa-devirt.c +++ b/gcc/ipa-devirt.c @@ -150,6 +150,7 @@ struct default_hash_traits { return TYPE_UID (p.first) ^ TYPE_UID (p.second); } + static const bool empty_zero_p = true; static bool is_empty (type_pair p) { diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index ddb3c9b21bc..d90cdf24454 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -78,6 +78,7 @@ struct ipa_bit_ggc_hash_traits : public ggc_cache_remove { return a->value == b->value && a->mask == b->mask; } + static const bool empty_zero_p = true; static void mark_empty (ipa_bits *&p) { @@ -123,6 +124,7 @@ struct ipa_vr_ggc_hash_traits : public ggc_cache_remove { return a->equal_p (*b); } + static const bool empty_zero_p = true; static void mark_empty (value_range *&p) { diff --git a/gcc/profile.c b/gcc/profile.c index e124dc6173a..6a2de21c3bd 100644 --- a/gcc/profile.c +++ b/gcc/profile.c @@ -932,6 +932,8 @@ struct location_triplet_hash : typed_noop_remove ref.lineno = -1; } + static const bool empty_zero_p = false; + static void mark_empty (location_triplet &ref) { diff --git a/gcc/sanopt.c b/gcc/sanopt.c index 8a29abe99e2..619aae45a15 100644 --- a/gcc/sanopt.c +++ b/gcc/sanopt.c @@ -129,6 +129,8 @@ struct sanopt_tree_triplet_hash : typed_noop_remove ref.t1 = reinterpret_cast (1); } + static const bool empty_zero_p = true; + static void mark_empty (sanopt_tree_triplet &ref) { @@ -184,6 +186,8 @@ struct sanopt_tree_couple_hash : typed_noop_remove ref.ptr = reinterpret_cast (1); } + static const bool empty_zero_p = true; + static void mark_empty (sanopt_tree_couple &ref) { diff --git a/gcc/tree-hasher.h b/gcc/tree-hasher.h index 787d1ad6a62..9194d6227a2 100644 --- a/gcc/tree-hasher.h +++ b/gcc/tree-hasher.h @@ -40,6 +40,7 @@ struct int_tree_hasher } static void mark_deleted (value_type &v) { v.to = reinterpret_cast (0x1); } static bool is_empty (const value_type &v) { return v.to == NULL; } + static const bool empty_zero_p = true; static void mark_empty (value_type &v) { v.to = NULL; } static void remove (value_type &) {} }; diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index 6f6b19eb165..3b27c50ef75 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -335,6 +335,7 @@ struct vn_ssa_aux_hasher : typed_noop_remove static inline hashval_t hash (const value_type &); static inline bool equal (const value_type &, const compare_type &); static inline void mark_deleted (value_type &) {} + static const bool empty_zero_p = true; static inline void mark_empty (value_type &e) { e = NULL; } static inline bool is_deleted (value_type &) { return false; } static inline bool is_empty (value_type &e) { return e == NULL; } diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index 9cb724b95ae..d164937b4b0 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -1193,6 +1193,7 @@ struct bst_traits static inline bool equal (value_type existing, value_type candidate); static inline bool is_empty (value_type x) { return !x.exists (); } static inline bool is_deleted (value_type x) { return !x.exists (); } + static const bool empty_zero_p = true; static inline void mark_empty (value_type &x) { x.release (); } static inline void mark_deleted (value_type &x) { x.release (); } static inline void remove (value_type &x) { x.release (); } diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h index 68cf96f6766..361f9a0741a 100644 --- a/gcc/tree-vectorizer.h +++ b/gcc/tree-vectorizer.h @@ -232,6 +232,8 @@ struct default_hash_traits && operand_equal_p (existing.op1, candidate.op1, 0)); } + static const bool empty_zero_p = true; + static inline void mark_empty (value_type &v) { From patchwork Tue Jan 14 04:51:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Malcolm X-Patchwork-Id: 1222459 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-517320-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha1 header.s=default header.b=oIf2WRiv; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=MZcpUj25; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47xdY770WZz9sPn for ; Tue, 14 Jan 2020 15:59:38 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; q=dns; s= default; b=BPj45oyIN5WEx39jlEJpYJW9jKBByphvpV4qRWQuptVI1mzTxa70T I0yTyuYmMjK533WMXhFmfpwIKavLPfWKkc3sp+ERRJREKUdtt/vqvZtF5D0WVmRS gX0z/6fPOF1u0B4T7Kxexh+R23mjhDB96tC88WdhMOCFbnzMrQyfR8= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; s=default; bh=ufstSyiJ7ER6dSCpGhLp2xr2M0Y=; b=oIf2WRiv7KQTi5Vibq/bdPRdBIuJ 1kSOHaegtzy0WjpxkYUbLyAZ1JXt+2opAmsz2LWFh7zfnVeo0P228CL/tQfrlmCu lvAHoph/EcUqxN+FKVoPJdv8EZb8x9sPpD92Y6ZksPSZjvz8CNG1M2laiua84eA1 RA8kYIYDkRP3Zbg= Received: (qmail 102663 invoked by alias); 14 Jan 2020 04:52:14 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 102648 invoked by uid 89); 14 Jan 2020 04:52:14 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-23.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=4076, deduplicating, H*MI:sk:10454af, 29137 X-HELO: us-smtp-delivery-1.mimecast.com Received: from us-smtp-1.mimecast.com (HELO us-smtp-delivery-1.mimecast.com) (207.211.31.81) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 14 Jan 2020 04:52:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578977531; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8y/BxWhc7Nz1+2H2SHWmrEG27DY0DpgYl7GZ4FoGzHY=; b=MZcpUj25+cWPUtH1JwluIaiArb3QHmk3xcT7Dpx5RX2W7zuGH0GFm7IuZ3cL197ZvKQ7Rp Ht2tYQxDRXb+gTU6+b059RrS7UbNQ6XrU3DW+E+5i2SFsj+LQ2BliLJfyjOv+XDWJpNzHI 3Sv60ua60xKNvsLTTR4gD2h+XKNQ/8I= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-277-MPvAbqhfMVeAeD4rZh6sUA-1; Mon, 13 Jan 2020 23:52:08 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1D47C107ACC7; Tue, 14 Jan 2020 04:52:07 +0000 (UTC) Received: from t470.redhat.com (ovpn-117-41.phx2.redhat.com [10.3.117.41]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9CF4F5DA7B; Tue, 14 Jan 2020 04:52:05 +0000 (UTC) From: David Malcolm To: Jakub Jelinek Cc: law@redhat.com, Richard Biener , gcc-patches@gcc.gnu.org, David Malcolm Subject: [PATCH 2/2] analyzer: add empty_zero_p for the various hash traits Date: Mon, 13 Jan 2020 23:51:54 -0500 Message-Id: <20200114045154.19021-2-dmalcolm@redhat.com> In-Reply-To: <20200114045154.19021-1-dmalcolm@redhat.com> References: <10454af11705eee5ca86ca83d351e81e04d6fc45.camel@redhat.com> <20200114045154.19021-1-dmalcolm@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-IsSubscribed: yes Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu OK for master? gcc/analyzer/ChangeLog: * diagnostic-manager.cc (dedupe_hash_map_traits::empty_zero_p): New static constant. * engine.cc (default_hash_traits::empty_zero_p): Likewise. * exploded-graph.h (eg_hash_map_traits::empty_zero_p): Likewise. (eg_point_hash_map_traits::empty_zero_p): Likewise. (eg_call_string_hash_map_traits::empty_zero_p): Likewise. * program-state.h (default_hash_traits::empty_zero_p): Likewise. * state-purge.h (default_hash_traits::empty_zero_p): Likewise. --- gcc/analyzer/diagnostic-manager.cc | 2 +- gcc/analyzer/engine.cc | 1 + gcc/analyzer/exploded-graph.h | 3 +++ gcc/analyzer/program-state.h | 1 + gcc/analyzer/state-purge.h | 1 + 5 files changed, 7 insertions(+), 1 deletion(-) diff --git a/gcc/analyzer/diagnostic-manager.cc b/gcc/analyzer/diagnostic-manager.cc index 12b8e5a4ac4..cd2c3bf2076 100644 --- a/gcc/analyzer/diagnostic-manager.cc +++ b/gcc/analyzer/diagnostic-manager.cc @@ -265,7 +265,7 @@ public: { return entry.m_key == NULL; } - + static const bool empty_zero_p = true; }; /* A class for deduplicating diagnostics and finding (and emitting) the diff --git a/gcc/analyzer/engine.cc b/gcc/analyzer/engine.cc index 3e3d8a120b7..720fa219d16 100644 --- a/gcc/analyzer/engine.cc +++ b/gcc/analyzer/engine.cc @@ -2913,6 +2913,7 @@ struct function_call_string template <> struct default_hash_traits : public pod_hash_traits { + static const bool empty_zero_p = false; }; template <> diff --git a/gcc/analyzer/exploded-graph.h b/gcc/analyzer/exploded-graph.h index ddc5e06b3b6..8c29e552cac 100644 --- a/gcc/analyzer/exploded-graph.h +++ b/gcc/analyzer/exploded-graph.h @@ -407,6 +407,7 @@ struct eg_hash_map_traits { return entry.m_key == NULL; } + static const bool empty_zero_p = false; }; /* Per-program_point data for an exploded_graph. */ @@ -473,6 +474,7 @@ struct eg_point_hash_map_traits { return entry.m_key == NULL; } + static const bool empty_zero_p = false; }; /* Data about a particular call_string within an exploded_graph. */ @@ -539,6 +541,7 @@ struct eg_call_string_hash_map_traits { return entry.m_key == NULL; } + static const bool empty_zero_p = false; }; /* Data about a particular function within an exploded_graph. */ diff --git a/gcc/analyzer/program-state.h b/gcc/analyzer/program-state.h index 37fb7cc4101..75b65b780c9 100644 --- a/gcc/analyzer/program-state.h +++ b/gcc/analyzer/program-state.h @@ -50,6 +50,7 @@ public: template <> struct default_hash_traits : public pod_hash_traits { + static const bool empty_zero_p = false; }; template <> diff --git a/gcc/analyzer/state-purge.h b/gcc/analyzer/state-purge.h index 77b7f622bbd..e33733a6cc5 100644 --- a/gcc/analyzer/state-purge.h +++ b/gcc/analyzer/state-purge.h @@ -26,6 +26,7 @@ along with GCC; see the file COPYING3. If not see template <> struct default_hash_traits : public pod_hash_traits { + static const bool empty_zero_p = false; }; template <>