From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nikam.ms.mff.cuni.cz (nikam.ms.mff.cuni.cz [195.113.20.16]) by sourceware.org (Postfix) with ESMTPS id B613A384EF59 for ; Mon, 12 Dec 2022 21:44:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B613A384EF59 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=ucw.cz Authentication-Results: sourceware.org; spf=none smtp.mailfrom=kam.mff.cuni.cz Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id DACCA280499; Mon, 12 Dec 2022 22:44:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ucw.cz; s=gen1; t=1670881466; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=H7j5f7WKMQ+PM4Mh66h/q/WlEBM2W2B5wt2CAGVjy48=; b=pgJT3bsSbiLDfFvpxJSbAhsluz+JO130TCsNpeKgCCe+i9fNFcAj5VqvL6IEAyuwl+Ff9S ke+TqwkGK+ydhhSJzuVpZnPK/CyIb3NMi9rjD4239qHtjDIY+8ITPPHzyMltBAwHqupmC1 /g5nDkkT96/LxNKCkTRe7ojcHnBkq5A= Date: Mon, 12 Dec 2022 22:44:26 +0100 From: Jan Hubicka To: Martin Jambor Cc: GCC Patches Subject: Re: [PATCH 3/9] ipa-cp: Leave removal of unused parameters to IPA-SRA Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,GIT_PATCH_0,HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: > Hi, > > I'm re-posting patches which I have posted at the end of stage 1 but > which have not passed review yet. > > 8<-------------------------------------------------------------------- > > Looking at some benchmarks I have noticed many cases when IPA-CP > cloned a function for all contexts just because it knew that some > parameters were not used at all. Then IPA-SRA looked at the function > and cloned it again to split another parameter or two. The latter > pass is better equipped to detect when parameters can be altogether > removed and so the IPA-CP cloning was for no good reason. > > This patch simply alters the IPA-CP not to do that in the situations > where IPA-SRA can (for nodes which can be made local). > > Bootstrapped and tested individually when I originally posted it and > now bootstrapped and LTO-bootstrapped and tested as part of the whole > series. OK for master? > > > gcc/ChangeLog: > > 2022-11-11 Martin Jambor > > * ipa-cp.cc (estimate_local_effects): Do not clone potentionally local > nodes for all contexts just to remove unused parameters. > --- > gcc/ipa-cp.cc | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/gcc/ipa-cp.cc b/gcc/ipa-cp.cc > index cc031ebed0f..172ea353c49 100644 > --- a/gcc/ipa-cp.cc > +++ b/gcc/ipa-cp.cc > @@ -3722,7 +3722,10 @@ estimate_local_effects (struct cgraph_node *node) > &removable_params_cost); > int devirt_bonus = devirtualization_time_bonus (node, &avals); > if (always_const || devirt_bonus > - || (removable_params_cost && node->can_change_signature)) > + || (removable_params_cost > + && node->can_change_signature > + /* If IPA-SRA can do it, it can do it better. */ > + && !node->can_be_local_p ())) Perhaps we could dump that into dump file (i.e. not cloning because ipa-sra will do it later). That could save me from debugging session in future :) OK with that change. Honza > { > struct caller_statistics stats; > ipa_call_estimates estimates; > -- > 2.38.1 >