From patchwork Thu Feb 2 01:36:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kugan Vivekanandarajah X-Patchwork-Id: 722723 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 3vDN0G5bxFz9ryr for ; Thu, 2 Feb 2017 12:37:17 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="ZS0z5cr/"; 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 :subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type; q=dns; s=default; b=pm08ys+a7JcJ+2ncn PT6X0s4FtcuujfiNkxyXAMCP90lsxN0cXfIxbGZfy3cVnxA9NldtJzZysdNIEOgL dlBLDUWZDK+YKJGleqoWpLY4Klzvp/HSvItxVLzLYXPl1IWQuOB1O7VN2875cQ3m +Oo/+FOHFfMamWHHPzRkTWw7g8= 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 :subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type; s=default; bh=L6gIc8TJb+48CVMDIuee2Li ue6U=; b=ZS0z5cr//6Ns8xxhzmc25V8KiMuwW+eP+rBOLZ+pjbLGX9nhapBZMAX 7Lgr696g3tvXLzadkPFeMcmprUDdi/Bk6Y7eOqKc4G1PN7QCjg4nlXmBsDg+ExOd WDZMXqbuhVJvecJuk2obje56d4pXzdEZB4bhkMVLyPvs/g508u/Y= Received: (qmail 34481 invoked by alias); 2 Feb 2017 01:37:05 -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 34464 invoked by uid 89); 2 Feb 2017 01:37:04 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=no version=3.3.2 spammy=bitmap, Hook, UD:ipa-prop.h, ipa-prop.h X-HELO: mail-pg0-f51.google.com Received: from mail-pg0-f51.google.com (HELO mail-pg0-f51.google.com) (74.125.83.51) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 02 Feb 2017 01:36:54 +0000 Received: by mail-pg0-f51.google.com with SMTP id 204so759645pge.0 for ; Wed, 01 Feb 2017 17:36:54 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to; bh=AOrh8IqACuuBmGk8sbYRcGYiqPFOYI0SL5Pywv9K0DI=; b=QuH2SSlZyaugW8+G5p+mUrO9g/DCnJy3Gbr6OYmPYR6YG2841+aBGiz8TeFUTthMTm nib0Pt0dYEsoGIwDh7RlsOigKVUB/uMEy4qLjwPhtpSqDp/ehpC6HfR7idnr82gnXtOB SOX5NRnzUi/IwxUZJlFcE6Kp+/nNZdPYfLORKkCV87qSfkGvHJ723ykAug/axuPMStI6 i/J6yfkG9Fk81t2fg3suV3mMx0IgPl63i2T4BwpVlHmsRio7fxDGx561W5riZfipZ8Dh KKsFZKb9cP6SVeHjJZf3eLddz/oSDUGs/n+JTsGybYi7I4xa1aRNABzdp0vjvH+W6EfZ HEgg== X-Gm-Message-State: AIkVDXIDcthgcqY9DB/ZtH5Ubj2IuJqtkyujfsGKlwmSXBm2qbDgXtouosEiAF9dYP/l0aXK X-Received: by 10.99.243.21 with SMTP id l21mr7508002pgh.37.1485999412840; Wed, 01 Feb 2017 17:36:52 -0800 (PST) Received: from [192.168.1.101] (59-102-73-185.tpgi.com.au. [59.102.73.185]) by smtp.gmail.com with ESMTPSA id r21sm52678013pfd.95.2017.02.01.17.36.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Feb 2017 17:36:51 -0800 (PST) Subject: Re: [RFC] Bug lto/78140 To: Richard Biener References: Cc: "gcc-patches@gcc.gnu.org" , Jan Hubicka , Martin Jambor From: kugan Message-ID: <7869ae12-9a1a-9d52-d194-60e8cd1cea45@linaro.org> Date: Thu, 2 Feb 2017 12:36:47 +1100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: X-IsSubscribed: yes Hi Richard, On 30/01/17 21:08, Richard Biener wrote: > On Mon, Jan 30, 2017 at 12:23 AM, kugan > wrote: >> lto1: internal compiler error: Segmentation fault >> 0xdedc4b crash_signal >> ../../gcc/gcc/toplev.c:333 >> 0xb46680 ipa_node_params_t::duplicate(cgraph_node*, cgraph_node*, >> ipa_node_params*, ipa_node_params*) >> ../../gcc/gcc/ipa-prop.c:3819 >> 0xb306a3 >> function_summary::symtab_duplication(cgraph_node*, >> cgraph_node*, void*) >> ../../gcc/gcc/symbol-summary.h:187 >> 0x85aba7 symbol_table::call_cgraph_duplication_hooks(cgraph_node*, >> cgraph_node*) >> ../../gcc/gcc/cgraph.c:488 >> 0x8765bf cgraph_node::create_clone(tree_node*, long, int, bool, >> vec, bool, cgraph_node*, bitmap_head*, char >> const*) >> ../../gcc/gcc/cgraphclones.c:522 >> 0x166fb3b clone_inlined_nodes(cgraph_edge*, bool, bool, int*, int) >> ../../gcc/gcc/ipa-inline-transform.c:227 >> 0x166fbd7 clone_inlined_nodes(cgraph_edge*, bool, bool, int*, int) >> ../../gcc/gcc/ipa-inline-transform.c:242 >> 0x1670893 inline_call(cgraph_edge*, bool, vec> vl_ptr>*, int*, bool, bool*) >> ../../gcc/gcc/ipa-inline-transform.c:449 >> 0x1665bd3 inline_small_functions >> ../../gcc/gcc/ipa-inline.c:2024 >> 0x1667157 ipa_inline >> ../../gcc/gcc/ipa-inline.c:2434 >> 0x1667fa7 execute >> ../../gcc/gcc/ipa-inline.c:2845 >> This is due to an existing issue. That is, in ipa_node_params_t::remove, m_vr and bits vectors are not set to null such that the gc can claim it. I also noticed that we don't create m_vr and bits vectors. Attached patch does this. This was bootstrapped and regression tested with the above patch. I am now testing the attached patch alone. Is this OK if no regressions? gcc/ChangeLog: 2017-02-02 Kugan Vivekanandarajah * ipa-cp.c (ipcp_store_bits_results): Construct bits vector. (ipcp_store_vr_results): Constrict m_vr vector. * ipa-prop.c (ipa_node_params_t::remove): Set transaction summary to null. (ipa_node_params_t::duplicate): Construct bits and m_vr vector. (read_ipcp_transformation_info): Likewise. Thanks, Kugan >> I tried similar think without variable structure like: >> diff --git a/gcc/ipa-prop.h b/gcc/ipa-prop.h >> index 93a2390c..b0cc832 100644 >> --- a/gcc/ipa-prop.h >> +++ b/gcc/ipa-prop.h >> @@ -525,7 +525,7 @@ struct GTY(()) ipcp_transformation_summary >> /* Known bits information. */ >> vec *bits; >> /* Value range information. */ >> - vec *m_vr; >> + vec *m_vr; >> }; >> >> This also has the same issue so I don't think it has anything to do with >> variable structure. > > You have to debug that detail yourself but I wonder why the transformation > summary has a different representation than the jump function (and I think > the jump function size is the issue). > > The JF has > > /* Information about zero/non-zero bits. */ > struct ipa_bits bits; > > /* Information about value range, containing valid data only when vr_known is > true. */ > value_range m_vr; > bool vr_known; > > with ipa_bits having two widest_ints and value_range having two trees > and an unused bitmap and ipa_vr having two wide_ints (widest_ints are > smaller!). > > Richard. > >> >> Thanks, >> Kugan diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c index aa3c997..5103555 100644 --- a/gcc/ipa-cp.c +++ b/gcc/ipa-cp.c @@ -4865,6 +4865,8 @@ ipcp_store_bits_results (void) ipcp_grow_transformations_if_necessary (); ipcp_transformation_summary *ts = ipcp_get_transformation_summary (node); + if (!ts->bits) + ts->bits = (new (ggc_cleared_alloc ()) ipa_bits_vec ()); vec_safe_reserve_exact (ts->bits, count); for (unsigned i = 0; i < count; i++) @@ -4940,6 +4942,8 @@ ipcp_store_vr_results (void) ipcp_grow_transformations_if_necessary (); ipcp_transformation_summary *ts = ipcp_get_transformation_summary (node); + if (!ts->m_vr) + ts->m_vr = new (ggc_cleared_alloc ()) ipa_vr_vec (); vec_safe_reserve_exact (ts->m_vr, count); for (unsigned i = 0; i < count; i++) diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index 834c27d..b992a7f 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -3759,13 +3759,20 @@ ipa_node_params_t::insert (cgraph_node *, ipa_node_params *info) to. */ void -ipa_node_params_t::remove (cgraph_node *, ipa_node_params *info) +ipa_node_params_t::remove (cgraph_node *node, ipa_node_params *info) { free (info->lattices); /* Lattice values and their sources are deallocated with their alocation pool. */ info->known_csts.release (); info->known_contexts.release (); + ipcp_transformation_summary *ts = ipcp_get_transformation_summary (node); + if (ts != NULL) + { + ts->agg_values = NULL; + ts->bits = NULL; + ts->m_vr = NULL; + } } /* Hook that is called by summary when a node is duplicated. */ @@ -3811,8 +3818,10 @@ ipa_node_params_t::duplicate(cgraph_node *src, cgraph_node *dst, ipcp_grow_transformations_if_necessary (); src_trans = ipcp_get_transformation_summary (src); const vec *src_vr = src_trans->m_vr; - vec *&dst_vr - = ipcp_get_transformation_summary (dst)->m_vr; + ipcp_transformation_summary *dts = ipcp_get_transformation_summary (dst); + if (!dts->m_vr) + dts->m_vr = (new (ggc_cleared_alloc ()) ipa_vr_vec ()); + vec *&dst_vr = dts->m_vr; if (vec_safe_length (src_trans->m_vr) > 0) { vec_safe_reserve_exact (dst_vr, src_vr->length ()); @@ -3826,8 +3835,10 @@ ipa_node_params_t::duplicate(cgraph_node *src, cgraph_node *dst, ipcp_grow_transformations_if_necessary (); src_trans = ipcp_get_transformation_summary (src); const vec *src_bits = src_trans->bits; - vec *&dst_bits - = ipcp_get_transformation_summary (dst)->bits; + ipcp_transformation_summary *dts = ipcp_get_transformation_summary (dst); + if (!dts->bits) + dts->bits = (new (ggc_cleared_alloc ()) ipa_bits_vec ()); + vec *&dst_bits = dts->bits; vec_safe_reserve_exact (dst_bits, src_bits->length ()); for (unsigned i = 0; i < src_bits->length (); ++i) dst_bits->quick_push ((*src_bits)[i]); @@ -5283,6 +5294,8 @@ read_ipcp_transformation_info (lto_input_block *ib, cgraph_node *node, ipcp_grow_transformations_if_necessary (); ipcp_transformation_summary *ts = ipcp_get_transformation_summary (node); + if (!ts->m_vr) + ts->m_vr = new (ggc_cleared_alloc ()) ipa_vr_vec (); vec_safe_grow_cleared (ts->m_vr, count); for (i = 0; i < count; i++) { @@ -5306,6 +5319,8 @@ read_ipcp_transformation_info (lto_input_block *ib, cgraph_node *node, ipcp_grow_transformations_if_necessary (); ipcp_transformation_summary *ts = ipcp_get_transformation_summary (node); + if (!ts->bits) + ts->bits = (new (ggc_cleared_alloc ()) ipa_bits_vec ()); vec_safe_grow_cleared (ts->bits, count); for (i = 0; i < count; i++) diff --git a/gcc/ipa-prop.h b/gcc/ipa-prop.h index 93a2390c..6573a78 100644 --- a/gcc/ipa-prop.h +++ b/gcc/ipa-prop.h @@ -528,6 +528,9 @@ struct GTY(()) ipcp_transformation_summary vec *m_vr; }; +typedef vec ipa_vr_vec; +typedef vec ipa_bits_vec; + void ipa_set_node_agg_value_chain (struct cgraph_node *node, struct ipa_agg_replacement_value *aggvals); void ipcp_grow_transformations_if_necessary (void);