From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 125063 invoked by alias); 20 Dec 2016 10:06:48 -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 125005 invoked by uid 89); 20 Dec 2016 10:06:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_PASS autolearn=ham version=3.3.2 spammy=Ready, guarded X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 20 Dec 2016 10:06:37 +0000 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 28468ABB0; Tue, 20 Dec 2016 10:06:35 +0000 (UTC) Date: Tue, 20 Dec 2016 10:22:00 -0000 From: Martin Jambor To: Martin =?utf-8?B?TGnFoWth?= Cc: GCC Patches , Jan Hubicka Subject: Re: [PATCH] Fix IPA CP where it forgot to add a reference in cgraph Message-ID: <20161220100634.xmespxfr2nurhilo@virgil.suse.cz> Mail-Followup-To: Martin =?utf-8?B?TGnFoWth?= , GCC Patches , Jan Hubicka References: <6421e992-7681-1456-2a73-ba79fd8b00c1@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <6421e992-7681-1456-2a73-ba79fd8b00c1@suse.cz> User-Agent: Mutt/1.6.2 (2016-07-01) X-IsSubscribed: yes X-SW-Source: 2016-12/txt/msg01692.txt.bz2 Hi, On Mon, Dec 19, 2016 at 11:09:52AM +0100, Martin Liska wrote: > Hello. > > Building mariadb with -flto exposes a bug which I also used to see > in Firefox. It's caused by IPA CP starting from r236418, where the > pass started to propagate const VAR_DECLs. Problem is that the pass > does not update call graph by adding IPA_REF_READ of the propagated > variable. > > Patch can bootstrap on ppc64le-redhat-linux and survives regression tests. > > Ready to be installed? Honza needs to have a look at this but since I have suggested this approach, I am of course fine with it, except that... > Martin > From 477e81fde08d0520ce552ec8baa0349590dc683c Mon Sep 17 00:00:00 2001 > From: marxin > Date: Mon, 19 Dec 2016 11:03:34 +0100 > Subject: [PATCH] Fix IPA CP where it forgot to add a reference in cgraph > > gcc/ChangeLog: > > 2016-12-19 Martin Liska > > * cgraphclones.c (cgraph_node::create_virtual_clone): > Create either IPA_REF_LOAD of IPA_REF_READ depending on > whether new_tree is a VAR_DECL or an ADDR_EXPR. > * ipa-cp.c (create_specialized_node): Add reference just for > ADDR_EXPRs. > * symtab.c (symtab_node::maybe_create_reference): Remove guard > as it's guarded in callers. > --- > gcc/cgraphclones.c | 6 +++++- > gcc/ipa-cp.c | 3 ++- > gcc/symtab.c | 2 -- > 3 files changed, 7 insertions(+), 4 deletions(-) > > diff --git a/gcc/cgraphclones.c b/gcc/cgraphclones.c > index 349892dab67..93c86e6a1cc 100644 > --- a/gcc/cgraphclones.c > +++ b/gcc/cgraphclones.c > @@ -624,7 +624,11 @@ cgraph_node::create_virtual_clone (vec redirect_callers, > || in_lto_p) > new_node->unique_name = true; > FOR_EACH_VEC_SAFE_ELT (tree_map, i, map) > - new_node->maybe_create_reference (map->new_tree, IPA_REF_ADDR, NULL); > + { > + ipa_ref_use use_type > + = TREE_CODE (map->new_tree) == VAR_DECL ? IPA_REF_ADDR : IPA_REF_LOAD; ...this test should be for ADDR_EXPR here. Or you could switch the IPA_REF_* constants the other way round which I bet is going to have the same effect in practice, but personally, I'd test for ADDR_EXPR. Thanks, Martin