From patchwork Mon Oct 17 15:57:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 683099 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 3syNCB0n7bz9s3T for ; Tue, 18 Oct 2016 02:57:57 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=DndsAa+t; dkim-atps=neutral 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:in-reply-to:references:date:message-id :mime-version:content-type:content-transfer-encoding; q=dns; s= default; b=TJHxKDLdsJnMVlSyYhFTGZaSYrVW5Ys1UISFKVWNdhM+M9Ktlaq1U UFzQEtfd6bsymC4fIYDAsruMXmMpoisFAl+o2ihJ6mEM0Os+BvuBaGwJXGDgGiFb Q0whwiLdqwIZyLWeMHC+cNhqvT6wMxVW5vskZ54XOVMf0f1Ps9RgAM= 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:in-reply-to:references:date:message-id :mime-version:content-type:content-transfer-encoding; s=default; bh=4w17R8RE+DZhPxiDiMVtPyyjs6o=; b=DndsAa+tMvYI/P+rrx/w89i2Kecb x1Juib9ADuus67pbic3ZcRBGt4KJ/MPEWqHmdFE7FSFTnKbczY6TXbT+z4rk74sV /Uxu9ugCPJyP5tZhsggO4qM//0FBSn56Ffkc2EpGahEpYihR1CXtDNVrKpl06GjE mkI+eg4zcPZj+qc= Received: (qmail 12986 invoked by alias); 17 Oct 2016 15:57:49 -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 12963 invoked by uid 89); 17 Oct 2016 15:57:48 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, SPF_PASS, URIBL_RED autolearn=ham version=3.3.2 spammy=gathered, feasible X-Spam-User: qpsmtpd, 2 recipients X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 17 Oct 2016 15:57:38 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=svr-ies-mbx-01.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1bwAIA-0003Ce-QR from Thomas_Schwinge@mentor.com ; Mon, 17 Oct 2016 08:57:35 -0700 Received: from hertz.schwinge.homeip.net (137.202.0.87) by svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Mon, 17 Oct 2016 16:57:30 +0100 From: Thomas Schwinge To: GCC Patches , Richard Biener CC: Joseph Myers , GCC Development , Jakub Jelinek , Bernd Schmidt Subject: Re: Explicitly list all tree codes in gcc/tree-streamer.c:record_common_node In-Reply-To: References: <20160817154244.GA39270@arm.com> <87h99s53ls.fsf@kepler.schwinge.homeip.net> <87d1kefwgt.fsf@hertz.schwinge.homeip.net> <87twdgb9zi.fsf@hertz.schwinge.homeip.net> <87poo4as2j.fsf@hertz.schwinge.homeip.net> <87bmzkb0h5.fsf@hertz.schwinge.homeip.net> <87lgya7odk.fsf@hertz.schwinge.homeip.net> User-Agent: Notmuch/0.9-101-g81dad07 (http://notmuchmail.org) Emacs/24.4.1 (x86_64-pc-linux-gnu) Date: Mon, 17 Oct 2016 17:57:27 +0200 Message-ID: <87pomz0xzs.fsf@hertz.schwinge.homeip.net> MIME-Version: 1.0 X-ClientProxiedBy: svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) Hi! On Fri, 30 Sep 2016 09:47:56 +0200, Richard Biener wrote: > On Thu, Sep 29, 2016 at 4:48 PM, Thomas Schwinge > wrote: > > On Mon, 19 Sep 2016 13:25:01 +0200, Richard Biener wrote: > >> On Mon, Sep 19, 2016 at 1:19 PM, Thomas Schwinge > >> wrote: > >> > On Mon, 19 Sep 2016 10:18:35 +0200, Richard Biener wrote: > >> >> On Fri, Sep 16, 2016 at 3:32 PM, Thomas Schwinge > >> >> wrote: > >> >> > --- gcc/tree-streamer.c > >> >> > +++ gcc/tree-streamer.c > >> >> > @@ -278,9 +278,23 @@ record_common_node (struct streamer_tree_cache_d *cache, tree node) > >> >> > streamer_tree_cache_append (cache, node, cache->nodes.length ()); > >> >> > > >> >> > if (POINTER_TYPE_P (node) > >> >> > - || TREE_CODE (node) == COMPLEX_TYPE > >> >> > || TREE_CODE (node) == ARRAY_TYPE) > >> >> > record_common_node (cache, TREE_TYPE (node)); > >> >> > + else if (TREE_CODE (node) == COMPLEX_TYPE) > >> >> > [...] > >> >> > else if (TREE_CODE (node) == RECORD_TYPE) > > > >> [looks to me we miss handling of vector type components alltogether, > >> maybe there are no global vector type trees ...] > > > > Looks like it, yes. Would a patch like the following be reasonable, > > which explicitly lists/handles all expected tree codes, or is something > > like that not feasible? (That's a subset of tree codes I gathered by a > > partial run of the GCC testsuite, and libgomp testsuite; not claiming > > this is complete.) > > I think it would be a nice thing to have indeed. > > So -- I'm inclined to approve this patch ;) After quite a bit of testing (contrib/config-list.mk, modified to run -fself-test with -flto, to exercise the code I'm modifying), I have now committed this to trunk in r241246: commit 29cfc397b0ec2c953ff929d0ba57001c7018ec0c Author: tschwinge Date: Mon Oct 17 15:56:22 2016 +0000 Explicitly list all tree codes in gcc/tree-streamer.c:record_common_node gcc/ * tree-streamer.c (record_common_node): Explicitly list expected tree codes. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241246 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/tree-streamer.c | 30 +++++++++++++++++++++++++----- 2 files changed, 30 insertions(+), 5 deletions(-) Grüße Thomas diff --git gcc/ChangeLog gcc/ChangeLog index 86df616..9acc738 100644 --- gcc/ChangeLog +++ gcc/ChangeLog @@ -1,3 +1,8 @@ +2016-10-17 Thomas Schwinge + + * tree-streamer.c (record_common_node): Explicitly list expected + tree codes. + 2016-10-17 Richard Biener PR tree-optimization/77988 diff --git gcc/tree-streamer.c gcc/tree-streamer.c index 7ea7096..2139e96 100644 --- gcc/tree-streamer.c +++ gcc/tree-streamer.c @@ -277,12 +277,28 @@ record_common_node (struct streamer_tree_cache_d *cache, tree node) in the cache as hash value. */ streamer_tree_cache_append (cache, node, cache->nodes.length ()); - if (POINTER_TYPE_P (node) - || TREE_CODE (node) == COMPLEX_TYPE - || TREE_CODE (node) == ARRAY_TYPE) - record_common_node (cache, TREE_TYPE (node)); - else if (TREE_CODE (node) == RECORD_TYPE) + switch (TREE_CODE (node)) { + case ERROR_MARK: + case FIELD_DECL: + case FIXED_POINT_TYPE: + case IDENTIFIER_NODE: + case INTEGER_CST: + case INTEGER_TYPE: + case POINTER_BOUNDS_TYPE: + case REAL_TYPE: + case TREE_LIST: + case VOID_CST: + case VOID_TYPE: + /* No recursive trees. */ + break; + case ARRAY_TYPE: + case COMPLEX_TYPE: + case POINTER_TYPE: + case REFERENCE_TYPE: + record_common_node (cache, TREE_TYPE (node)); + break; + case RECORD_TYPE: /* The FIELD_DECLs of structures should be shared, so that every COMPONENT_REF uses the same tree node when referencing a field. Pointer equality between FIELD_DECLs is used by the alias @@ -291,6 +307,10 @@ record_common_node (struct streamer_tree_cache_d *cache, tree node) nonoverlapping_component_refs_of_decl_p). */ for (tree f = TYPE_FIELDS (node); f; f = TREE_CHAIN (f)) record_common_node (cache, f); + break; + default: + /* Unexpected tree code. */ + gcc_unreachable (); } }