From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 92575 invoked by alias); 29 Sep 2016 13:18:21 -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 92530 invoked by uid 89); 29 Sep 2016 13:18:19 -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 autolearn=ham version=3.3.2 spammy=richard.guenther@gmail.com, richardguenthergmailcom, U*richard.guenther, linear 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; Thu, 29 Sep 2016 13:18:09 +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 1bpbDy-0005Rp-B9 from Thomas_Schwinge@mentor.com ; Thu, 29 Sep 2016 06:18:06 -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; Thu, 29 Sep 2016 14:18:02 +0100 From: Thomas Schwinge To: GCC Patches , Richard Biener CC: Joseph Myers , GCC Development , Jakub Jelinek , Bernd Schmidt Subject: Re: [PR lto/77458] Avoid ICE in offloading with differing _FloatN, _FloatNx types 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> User-Agent: Notmuch/0.9-101-g81dad07 (http://notmuchmail.org) Emacs/24.4.1 (x86_64-pc-linux-gnu) Date: Thu, 29 Sep 2016 13:26:00 -0000 Message-ID: <87shsi7sl3.fsf@hertz.schwinge.homeip.net> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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) X-SW-Source: 2016-09/txt/msg02244.txt.bz2 Hi Richard! 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) =3D=3D COMPLEX_TYPE > >> > || TREE_CODE (node) =3D=3D ARRAY_TYPE) > >> > record_common_node (cache, TREE_TYPE (node)); > >> > + else if (TREE_CODE (node) =3D=3D COMPLEX_TYPE) > >> > + { > >> > + /* Assert that complex types' component types have already be= en handled > >> > + (and we thus don't need to recurse here). See PR lto/77458= . */ > >> > +[...] > >> So I very much like to go forward with this kind of change as well > > [patch] > Ok with [changes] Like this? (I'll then continue to replicate this for other tree codes.) commit b304f88f7226d93c8e13584a916cc713a989a635 Author: Thomas Schwinge Date: Wed Sep 28 12:36:59 2016 +0200 [PR lto/77458] Avoid ICE in offloading with differing _FloatN, _FloatNx= types =20=20=20=20 gcc/ PR lto/77458 * tree-core.h (enum tree_index): Put the complex types after their component types. * tree-streamer.c (verify_common_node_recorded): New function. (preload_common_nodes) : Use it. --- gcc/tree-core.h | 31 +++++++++++++++++-------------- gcc/tree-streamer.c | 33 ++++++++++++++++++++++++++++++++- 2 files changed, 49 insertions(+), 15 deletions(-) diff --git gcc/tree-core.h gcc/tree-core.h index 353a625..35b67c9 100644 --- gcc/tree-core.h +++ gcc/tree-core.h @@ -553,20 +553,6 @@ enum tree_index { TI_BOOLEAN_FALSE, TI_BOOLEAN_TRUE, =20 - TI_COMPLEX_INTEGER_TYPE, - TI_COMPLEX_FLOAT_TYPE, - TI_COMPLEX_DOUBLE_TYPE, - TI_COMPLEX_LONG_DOUBLE_TYPE, - - TI_COMPLEX_FLOAT16_TYPE, - TI_COMPLEX_FLOATN_NX_TYPE_FIRST =3D TI_COMPLEX_FLOAT16_TYPE, - TI_COMPLEX_FLOAT32_TYPE, - TI_COMPLEX_FLOAT64_TYPE, - TI_COMPLEX_FLOAT128_TYPE, - TI_COMPLEX_FLOAT32X_TYPE, - TI_COMPLEX_FLOAT64X_TYPE, - TI_COMPLEX_FLOAT128X_TYPE, - TI_FLOAT_TYPE, TI_DOUBLE_TYPE, TI_LONG_DOUBLE_TYPE, @@ -596,6 +582,23 @@ enum tree_index { - TI_FLOATN_NX_TYPE_FIRST \ + 1) =20 + /* Put the complex types after their component types, so that in (sequen= tial) + tree streaming we can assert that their component types have already = been + handled (see tree-streamer.c:record_common_node). */ + TI_COMPLEX_INTEGER_TYPE, + TI_COMPLEX_FLOAT_TYPE, + TI_COMPLEX_DOUBLE_TYPE, + TI_COMPLEX_LONG_DOUBLE_TYPE, + + TI_COMPLEX_FLOAT16_TYPE, + TI_COMPLEX_FLOATN_NX_TYPE_FIRST =3D TI_COMPLEX_FLOAT16_TYPE, + TI_COMPLEX_FLOAT32_TYPE, + TI_COMPLEX_FLOAT64_TYPE, + TI_COMPLEX_FLOAT128_TYPE, + TI_COMPLEX_FLOAT32X_TYPE, + TI_COMPLEX_FLOAT64X_TYPE, + TI_COMPLEX_FLOAT128X_TYPE, + TI_FLOAT_PTR_TYPE, TI_DOUBLE_PTR_TYPE, TI_LONG_DOUBLE_PTR_TYPE, diff --git gcc/tree-streamer.c gcc/tree-streamer.c index 7ea7096..6ada89a 100644 --- gcc/tree-streamer.c +++ gcc/tree-streamer.c @@ -248,6 +248,32 @@ streamer_tree_cache_lookup (struct streamer_tree_cache= _d *cache, tree t, } =20 =20 +/* Verify that NODE is in CACHE. */ + +static void +verify_common_node_recorded (struct streamer_tree_cache_d *cache, tree nod= e) +{ + /* Restrict this to flag_checking only because in general violating it is + harmless plus we never know what happens on all targets/frontend/flag= (!) + combinations. */ + if (!flag_checking) + return; + + bool found =3D false; + if (cache->node_map) + gcc_assert (streamer_tree_cache_lookup (cache, node, NULL)); + else + { + gcc_assert (cache->nodes.exists ()); + /* Linear search... */ + for (unsigned i =3D 0; !found && i < cache->nodes.length (); ++i) + if (cache->nodes[i] =3D=3D node) + found =3D true; + gcc_assert (found); + } +} + + /* Record NODE in CACHE. */ =20 static void @@ -278,9 +304,14 @@ record_common_node (struct streamer_tree_cache_d *cach= e, tree node) streamer_tree_cache_append (cache, node, cache->nodes.length ()); =20 if (POINTER_TYPE_P (node) - || TREE_CODE (node) =3D=3D COMPLEX_TYPE || TREE_CODE (node) =3D=3D ARRAY_TYPE) record_common_node (cache, TREE_TYPE (node)); + else if (TREE_CODE (node) =3D=3D COMPLEX_TYPE) + { + /* Verify that a complex type's component type (node_type) has been + handled already (and we thus don't need to recurse here). */ + verify_common_node_recorded (cache, TREE_TYPE (node)); + } else if (TREE_CODE (node) =3D=3D RECORD_TYPE) { /* The FIELD_DECLs of structures should be shared, so that every Gr=C3=BC=C3=9Fe Thomas