public inbox for
 help / color / mirror / Atom feed
* [PATCH 06/12] ipa-cp: Leave removal of unused parameters to IPA-SRA
@ 2022-11-12  1:46 Martin Jambor
  0 siblings, 0 replies; only message in thread
From: Martin Jambor @ 2022-11-12  1:46 UTC (permalink / raw)
  To: GCC Patches; +Cc: Jan Hubicka, Jan Hubicka


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 on x86_64-linux.  OK for master?




2022-11-11  Martin Jambor  <>

	* (estimate_local_effects): Do not clone potentionally local
	nodes for all contexts just to remove unused parameters.
 gcc/ | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gcc/ b/gcc/
index 02bd6a0fd1a..eb4474eb8b3 100644
--- a/gcc/
+++ b/gcc/
@@ -3722,7 +3722,10 @@ estimate_local_effects (struct cgraph_node *node)
   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 ()))
       struct caller_statistics stats;
       ipa_call_estimates estimates;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-11-12  1:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-12  1:46 [PATCH 06/12] ipa-cp: Leave removal of unused parameters to IPA-SRA Martin Jambor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).