From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 82314 invoked by alias); 20 Nov 2019 08:57:40 -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 82294 invoked by uid 89); 20 Nov 2019 08:57:39 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-18.4 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 20 Nov 2019 08:57:38 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 2324FB276; Wed, 20 Nov 2019 08:57:36 +0000 (UTC) Date: Wed, 20 Nov 2019 09:16:00 -0000 From: Richard Biener To: Alexandre Oliva cc: gcc-patches@gcc.gnu.org, ebotcazou@adacore.com, joseph@codesourcery.com Subject: Re: introduce -fcallgraph-info option In-Reply-To: Message-ID: References: <84223B6B-F6F0-4B94-835E-6661E1E1EB6A@suse.de> User-Agent: Alpine 2.21 (LSU 202 2017-01-01) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="-1609908220-1576377330-1574240256=:5566" X-SW-Source: 2019-11/txt/msg01906.txt.bz2 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. ---1609908220-1576377330-1574240256=:5566 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 8BIT Content-length: 3777 On Wed, 20 Nov 2019, Alexandre Oliva wrote: > On Nov 6, 2019, Alexandre Oliva wrote: > > > (CALLEE_FROM_CGRAPH_P): New. > > (dump_final_callee_vcg, dump_final_node_vcg): New. > > I goofed in the testing of this last-minute change. It only works with > optimization disabled. With any optimization enabled, > pass_remove_cgraph_callee_edges runs first thing in > pass_all_optimizations{,_g} without a subsequent > pass_rebuild_cgraph_edges. This release takes place long before we'd > even know which calls make to expand, and thus to the callgraph-info > expected output. > > It has just occurred to me that I could retain the logic but make it > conditional on !optimize, but that would be error prone (AFAICT there's > no reason why we don't release callees early without optimization) and > probably not worth it. > > > drop attempt to reuse cgraph callees for -fcallgraph-info > > The information in cgraph callees is released long before we get to > the point in which -fcallgraph-info edges are dumped, or even > expanded. It doesn't make sense to retain it longer: the edges > created for -fcallgraph-info are much smaller, and they don't even > coexist, so not even peak use grows. > > Regstrapped on x86_64-linux-gnu. Ok to install? OK. Richard. > > for gcc/ChangeLog > > * function.h (CALLEE_FROM_CGRAPH_P): Remove. > * function.c (record_final_call): Record even calls that might > have been in the cgraph. > * toplev.c (dump_final_node_vcg): Skip iteration over cgraph > callees. > --- > gcc/function.c | 3 --- > gcc/function.h | 5 +---- > gcc/toplev.c | 8 -------- > 3 files changed, 1 insertion(+), 15 deletions(-) > > diff --git a/gcc/function.c b/gcc/function.c > index 1fe956b..2534c92 100644 > --- a/gcc/function.c > +++ b/gcc/function.c > @@ -6406,9 +6406,6 @@ rest_of_handle_thread_prologue_and_epilogue (void) > void > record_final_call (tree callee, location_t location) > { > - if (!callee || CALLEE_FROM_CGRAPH_P (callee)) > - return; > - > struct callinfo_callee datum = { location, callee }; > vec_safe_push (cfun->su->callees, datum); > } > diff --git a/gcc/function.h b/gcc/function.h > index 14794c4..beb5c7d 100644 > --- a/gcc/function.h > +++ b/gcc/function.h > @@ -192,15 +192,12 @@ public: > poly_int64 length; > }; > > -/* Describe emitted builtin calls for -fcallgraph-info. Those that > - are not builtin are taken from cgraph edges. */ > +/* Describe emitted calls for -fcallgraph-info. */ > struct GTY(()) callinfo_callee > { > location_t location; > tree decl; > }; > -#define CALLEE_FROM_CGRAPH_P(T) \ > - (!fndecl_built_in_p (T) && !DECL_IS_BUILTIN (T)) > > /* Describe dynamic allocation for -fcallgraph-info=da. */ > struct GTY(()) callinfo_dalloc > diff --git a/gcc/toplev.c b/gcc/toplev.c > index d4583ba..3b9f9ee 100644 > --- a/gcc/toplev.c > +++ b/gcc/toplev.c > @@ -1093,14 +1093,6 @@ dump_final_node_vcg (FILE *f) > dump_final_callee_vcg (f, c->location, c->decl); > vec_free (cfun->su->callees); > cfun->su->callees = NULL; > - > - cgraph_node *cnode = cgraph_node::get (current_function_decl); > - for (cgraph_edge *e = cnode->callees; e; e = e->next_callee) > - if (CALLEE_FROM_CGRAPH_P (e->callee->decl)) > - dump_final_callee_vcg (f, gimple_location (e->call_stmt), > - e->callee->decl); > - for (cgraph_edge *e = cnode->indirect_calls; e; e = e->next_callee) > - dump_final_callee_vcg (f, gimple_location (e->call_stmt), NULL); > } > > /* Output stack usage and callgraph info, as requested. */ > > > > > -- Richard Biener SUSE Software Solutions Germany GmbH, Maxfeldstrasse 5, 90409 Nuernberg, Germany; GF: Felix Imendörffer; HRB 36809 (AG Nuernberg) ---1609908220-1576377330-1574240256=:5566--