public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 02/12] ipa-cp: Do not consider useless aggregate constants
@ 2022-11-12  1:45 Martin Jambor
  2022-11-13 21:06 ` Martin Jambor
  2022-11-16 10:50 ` Jan Hubicka
  0 siblings, 2 replies; 3+ messages in thread
From: Martin Jambor @ 2022-11-12  1:45 UTC (permalink / raw)
  To: GCC Patches; +Cc: Jan Hubicka, Jan Hubicka

Hi,

When building vectors of known aggregate values, there is no point in
including those for parameters which are not used in any way
whatsoever.

Bootstrapped and tested on x86_64-linux.  OK for master?

Thanks,

Martin


gcc/ChangeLog:

2022-11-11  Martin Jambor  <mjambor@suse.cz>

	* ipa-cp.cc (push_agg_values_from_edge): Do not consider constants
	in unused aggregate parameters.
---
 gcc/ipa-cp.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/ipa-cp.cc b/gcc/ipa-cp.cc
index d2bcd5e5e69..02bd6a0fd1a 100644
--- a/gcc/ipa-cp.cc
+++ b/gcc/ipa-cp.cc
@@ -5783,7 +5783,8 @@ push_agg_values_from_edge (struct cgraph_edge *cs,
 	}
 
       ipcp_param_lattices *plats = ipa_get_parm_lattices (dest_info, index);
-      if (plats->aggs_bottom)
+      if (!ipa_is_param_used (dest_info, index)
+	  || plats->aggs_bottom)
 	continue;
       push_agg_values_for_index_from_edge (cs, index, res, interim);
     }
-- 
2.38.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 02/12] ipa-cp: Do not consider useless aggregate constants
  2022-11-12  1:45 [PATCH 02/12] ipa-cp: Do not consider useless aggregate constants Martin Jambor
@ 2022-11-13 21:06 ` Martin Jambor
  2022-11-16 10:50 ` Jan Hubicka
  1 sibling, 0 replies; 3+ messages in thread
From: Martin Jambor @ 2022-11-13 21:06 UTC (permalink / raw)
  To: GCC Patches; +Cc: Jan Hubicka, Jan Hubicka

On Sat, Nov 12 2022, Martin Jambor wrote:
> Hi,
>
> When building vectors of known aggregate values, there is no point in
> including those for parameters which are not used in any way
> whatsoever.
>
> Bootstrapped and tested on x86_64-linux.  OK for master?
>
> Thanks,
>
> Martin

When doing LTO profiled-bootstrap, the original patch triggered a
checking assert that a selected constant was not among those discovered
to be known.  The following avoids doing any heuristics for unused
parameters too.  With this patch, the whole series passes LTO
profiled-bootstrap (and testing) on x86_64.

Martin



When building vectors of known aggregate values, there is no point in
including those for parameters which are not used in any way
whatsoever.  This patch avoids that together with also other kinds of
constants.

gcc/ChangeLog:

2022-11-13  Martin Jambor  <mjambor@suse.cz>

	* ipa-cp.cc (push_agg_values_from_edge): Do not consider constants
	in unused aggregate parameters.
---
 gcc/ipa-cp.cc | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/gcc/ipa-cp.cc b/gcc/ipa-cp.cc
index d2bcd5e5e69..313336a9ccd 100644
--- a/gcc/ipa-cp.cc
+++ b/gcc/ipa-cp.cc
@@ -5783,7 +5783,8 @@ push_agg_values_from_edge (struct cgraph_edge *cs,
 	}
 
       ipcp_param_lattices *plats = ipa_get_parm_lattices (dest_info, index);
-      if (plats->aggs_bottom)
+      if (!ipa_is_param_used (dest_info, index)
+	  || plats->aggs_bottom)
 	continue;
       push_agg_values_for_index_from_edge (cs, index, res, interim);
     }
@@ -6147,6 +6148,9 @@ decide_whether_version_node (struct cgraph_node *node)
 
   for (i = 0; i < count;i++)
     {
+      if (!ipa_is_param_used (info, i))
+	continue;
+
       class ipcp_param_lattices *plats = ipa_get_parm_lattices (info, i);
       ipcp_lattice<tree> *lat = &plats->itself;
       ipcp_lattice<ipa_polymorphic_call_context> *ctxlat = &plats->ctxlat;
-- 
2.38.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 02/12] ipa-cp: Do not consider useless aggregate constants
  2022-11-12  1:45 [PATCH 02/12] ipa-cp: Do not consider useless aggregate constants Martin Jambor
  2022-11-13 21:06 ` Martin Jambor
@ 2022-11-16 10:50 ` Jan Hubicka
  1 sibling, 0 replies; 3+ messages in thread
From: Jan Hubicka @ 2022-11-16 10:50 UTC (permalink / raw)
  To: Martin Jambor; +Cc: GCC Patches

> Hi,
> 
> When building vectors of known aggregate values, there is no point in
> including those for parameters which are not used in any way
> whatsoever.
> 
> Bootstrapped and tested on x86_64-linux.  OK for master?
OK,
thanks!
Honza
> 
> Thanks,
> 
> Martin
> 
> 
> gcc/ChangeLog:
> 
> 2022-11-11  Martin Jambor  <mjambor@suse.cz>
> 
> 	* ipa-cp.cc (push_agg_values_from_edge): Do not consider constants
> 	in unused aggregate parameters.
> ---
>  gcc/ipa-cp.cc | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/gcc/ipa-cp.cc b/gcc/ipa-cp.cc
> index d2bcd5e5e69..02bd6a0fd1a 100644
> --- a/gcc/ipa-cp.cc
> +++ b/gcc/ipa-cp.cc
> @@ -5783,7 +5783,8 @@ push_agg_values_from_edge (struct cgraph_edge *cs,
>  	}
>  
>        ipcp_param_lattices *plats = ipa_get_parm_lattices (dest_info, index);
> -      if (plats->aggs_bottom)
> +      if (!ipa_is_param_used (dest_info, index)
> +	  || plats->aggs_bottom)
>  	continue;
>        push_agg_values_for_index_from_edge (cs, index, res, interim);
>      }
> -- 
> 2.38.0
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-11-16 10:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-12  1:45 [PATCH 02/12] ipa-cp: Do not consider useless aggregate constants Martin Jambor
2022-11-13 21:06 ` Martin Jambor
2022-11-16 10:50 ` Jan Hubicka

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).