From patchwork Thu Nov 18 17:57:56 2021 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: 47897 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5A6B13857439 for ; Thu, 18 Nov 2021 17:58:15 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id BB18A3858422 for ; Thu, 18 Nov 2021 17:57:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BB18A3858422 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.cz Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 0EE4F21155; Thu, 18 Nov 2021 17:57:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1637258277; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OzarxGhs3s99M1TJKRDk62YdPQVACyw/auUEbdYeMBo=; b=oLvaAYiUyZjhWcX7/2QHSOD2lfa0Vwd51Lb8+84ct+A9Pb0HO/F7P0yEfRvQlJfVhTZ0Fm omylF/bsMK5mS3SUWJbbibLkYQrZO7F5d1YtpbJ5SkqauBKAxqwbOlsxeii+wIe44RHBYi h/mr2yObAmpCdyMJS/M1fRIDPPXPNXM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1637258277; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OzarxGhs3s99M1TJKRDk62YdPQVACyw/auUEbdYeMBo=; b=34FyOHtAhrr+F+PTqV3LLaqDB87XAFlsGWgNDy39VtxizBbg0RbNcajF+bdkX2EgBrcur2 MFAFDnY7msS+K8Dg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id F022613D76; Thu, 18 Nov 2021 17:57:56 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id iHucOSSUlmHFYQAAMHmgww (envelope-from ); Thu, 18 Nov 2021 17:57:56 +0000 Message-ID: Date: Thu, 18 Nov 2021 18:57:56 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.3.0 From: =?utf-8?q?Martin_Li=C5=A1ka?= Subject: [PATCH] IPA: use cgraph_node instance To: gcc-patches@gcc.gnu.org Content-Language: en-US X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jan Hubicka Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Hi. This is a refactoring I noticed. Patch can bootstrap on x86_64-linux-gnu and survives regression tests. Ready to be installed? Thanks, Martin gcc/ChangeLog: * ipa-modref.c (analyze_function): Use fnode instead of repeated cgraph_node::get (current_function_decl). --- gcc/ipa-modref.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/gcc/ipa-modref.c b/gcc/ipa-modref.c index c94f0589d44..a3c7c6d6a1f 100644 --- a/gcc/ipa-modref.c +++ b/gcc/ipa-modref.c @@ -2870,22 +2870,22 @@ analyze_function (function *f, bool ipa) { if (dump_file && (summary - = optimization_summaries->get (cgraph_node::get (f->decl))) + = optimization_summaries->get (fnode)) != NULL && summary->loads) { fprintf (dump_file, "Past summary:\n"); optimization_summaries->get - (cgraph_node::get (f->decl))->dump (dump_file); + (fnode)->dump (dump_file); past_flags.reserve_exact (summary->arg_flags.length ()); past_flags.splice (summary->arg_flags); past_retslot_flags = summary->retslot_flags; past_static_chain_flags = summary->static_chain_flags; past_flags_known = true; } - optimization_summaries->remove (cgraph_node::get (f->decl)); + optimization_summaries->remove (fnode); } - summary = optimization_summaries->get_create (cgraph_node::get (f->decl)); + summary = optimization_summaries->get_create (fnode); gcc_checking_assert (nolto && !lto); } /* In IPA mode we analyze every function precisely once. Assert that. */ @@ -2896,16 +2896,16 @@ analyze_function (function *f, bool ipa) if (!summaries) summaries = modref_summaries::create_ggc (symtab); else - summaries->remove (cgraph_node::get (f->decl)); - summary = summaries->get_create (cgraph_node::get (f->decl)); + summaries->remove (fnode); + summary = summaries->get_create (fnode); } if (lto) { if (!summaries_lto) summaries_lto = modref_summaries_lto::create_ggc (symtab); else - summaries_lto->remove (cgraph_node::get (f->decl)); - summary_lto = summaries_lto->get_create (cgraph_node::get (f->decl)); + summaries_lto->remove (fnode); + summary_lto = summaries_lto->get_create (fnode); } if (!fnspec_summaries) fnspec_summaries = new fnspec_summaries_t (symtab); @@ -3024,13 +3024,11 @@ analyze_function (function *f, bool ipa) { if (!summary->loads->every_base && !summary->loads->bases && !summary->calls_interposable) - fixup_cfg = ipa_make_function_const - (cgraph_node::get (current_function_decl), - summary->side_effects, true); + fixup_cfg = ipa_make_function_const (fnode, + summary->side_effects, true); else - fixup_cfg = ipa_make_function_pure - (cgraph_node::get (current_function_decl), - summary->side_effects, true); + fixup_cfg = ipa_make_function_pure (fnode, + summary->side_effects, true); } } if (summary && !summary->useful_p (ecf_flags))