From patchwork Tue Dec 20 14:55:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Martin_Li=C5=A1ka?= X-Patchwork-Id: 88603 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp1762740qgi; Tue, 20 Dec 2016 06:56:18 -0800 (PST) X-Received: by 10.84.215.194 with SMTP id g2mr44094182plj.16.1482245778472; Tue, 20 Dec 2016 06:56:18 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id m25si22515399pli.104.2016.12.20.06.56.18 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Dec 2016 06:56:18 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-444847-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org; spf=pass (google.com: domain of gcc-patches-return-444847-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-444847-patch=linaro.org@gcc.gnu.org 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:from:message-id:date:mime-version :in-reply-to:content-type; q=dns; s=default; b=IJ2DdPnPbPzx1busp kKpUxm7+xOQk9oHg13dNIpLbWBrdrpEWL4MANdVV2XSi2zO28JRIuVCZmR0Y6KnN whWHwVOJ1B4RNTZ2sD5sBaUQdgAQmnYnwBFiVQIGrrnO7YorMeNkDsKB+fdA8Pih nl6JHOl59oyBpQ13bUiwT4Wj7s= 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:from:message-id:date:mime-version :in-reply-to:content-type; s=default; bh=wrCE6/yRCKeMKRPQxiWGIQS uIfQ=; b=JkVWnyVcPg5nL65CL6+PrXXVxoz73wMSO12FoAvFmBp49Ff3WuhhI64 D4A7uncVNRrYD3u+FsLNuAiuHamTywLF6yG348uV1VMvl+bn+ePWaqhEKfhllR6B F6Zj7ICKN561AGqxh/Qvfrj4pQ3UPHlwzxpbjx32Aa8XKu+WDaxg= Received: (qmail 82230 invoked by alias); 20 Dec 2016 14:56:01 -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 82116 invoked by uid 89); 20 Dec 2016 14:56:00 -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=Jambor, jambor 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 14:55:50 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id B70BAAD4C; Tue, 20 Dec 2016 14:55:47 +0000 (UTC) Subject: Re: [PATCH] Fix IPA CP where it forgot to add a reference in cgraph To: GCC Patches , Jan Hubicka References: <6421e992-7681-1456-2a73-ba79fd8b00c1@suse.cz> <20161220100634.xmespxfr2nurhilo@virgil.suse.cz> From: =?UTF-8?Q?Martin_Li=c5=a1ka?= Message-ID: <87b66126-34a7-4935-d078-a14d979b3c9a@suse.cz> Date: Tue, 20 Dec 2016 15:55:47 +0100 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: <20161220100634.xmespxfr2nurhilo@virgil.suse.cz> X-IsSubscribed: yes On 12/20/2016 11:06 AM, Martin Jambor wrote: > ...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 for the note, fixed (and tested in second version of the patch). Martin > > Thanks, > > Martin >From 2e29080e44cce899f9d5181185aba0a8a8791a9a 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..6c8fe156f23 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) == ADDR_EXPR ? IPA_REF_ADDR : IPA_REF_LOAD; + new_node->maybe_create_reference (map->new_tree, use_type, NULL); + } if (ipa_transforms_to_apply.exists ()) new_node->ipa_transforms_to_apply diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c index d3b50524457..fd312b56fde 100644 --- a/gcc/ipa-cp.c +++ b/gcc/ipa-cp.c @@ -3787,7 +3787,8 @@ create_specialized_node (struct cgraph_node *node, args_to_skip, "constprop"); ipa_set_node_agg_value_chain (new_node, aggvals); for (av = aggvals; av; av = av->next) - new_node->maybe_create_reference (av->value, IPA_REF_ADDR, NULL); + if (TREE_CODE (av->value) == ADDR_EXPR) + new_node->maybe_create_reference (av->value, IPA_REF_ADDR, NULL); if (dump_file && (dump_flags & TDF_DETAILS)) { diff --git a/gcc/symtab.c b/gcc/symtab.c index 73168a8db09..562a4a2f6a6 100644 --- a/gcc/symtab.c +++ b/gcc/symtab.c @@ -598,8 +598,6 @@ symtab_node::maybe_create_reference (tree val, enum ipa_ref_use use_type, gimple *stmt) { STRIP_NOPS (val); - if (TREE_CODE (val) != ADDR_EXPR) - return NULL; val = get_base_var (val); if (val && VAR_OR_FUNCTION_DECL_P (val)) { -- 2.11.0