aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Jambor <mjambor@suse.cz>2022-11-22 18:22:03 +0100
committerMartin Jambor <mjambor@suse.cz>2022-11-22 18:29:06 +0100
commitfeeb0d68f1c7085199c3734e6517a3a4b58309ef (patch)
tree6757f67a12d3ba4459d41d8c46465feabcb4cb05
parentc826a041081bfe9171353159a41da29b4667cdc0 (diff)
downloadgcc-feeb0d68f1c7085199c3734e6517a3a4b58309ef.zip
gcc-feeb0d68f1c7085199c3734e6517a3a4b58309ef.tar.gz
gcc-feeb0d68f1c7085199c3734e6517a3a4b58309ef.tar.bz2
ipa-cp: Do not consider useless aggregate constants
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.
-rw-r--r--gcc/ipa-cp.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/ipa-cp.cc b/gcc/ipa-cp.cc
index f0feb4b..d5230c7 100644
--- a/gcc/ipa-cp.cc
+++ b/gcc/ipa-cp.cc
@@ -5785,7 +5785,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,
optimize_self_recursion ? interim
@@ -6151,6 +6152,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;