aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrevor Saunders <tbsaunde@tbsaunde.org>2021-06-06 16:30:29 -0400
committerTrevor Saunders <tbsaunde@tbsaunde.org>2021-06-17 04:43:27 -0400
commit265af872a1f8d7ffda2c4056d1d80a3ec4fc8650 (patch)
treeee5fef6ca6bb101bc48ba0c0762694f0a43b1967
parente9681f5725f54a58098678cdea19d1e90d9a36e3 (diff)
downloadgcc-265af872a1f8d7ffda2c4056d1d80a3ec4fc8650.zip
gcc-265af872a1f8d7ffda2c4056d1d80a3ec4fc8650.tar.gz
gcc-265af872a1f8d7ffda2c4056d1d80a3ec4fc8650.tar.bz2
return auto_vec from cgraph_node::collect_callers
This ensures the callers of collect_callers () take ownership of the vector and free it when appropriate. Signed-off-by: Trevor Saunders <tbsaunde@tbsaunde.org> gcc/ChangeLog: * cgraph.c (cgraph_node::collect_callers): Return auto_vec<cgraph_edge *>. * cgraph.h (cgraph_node::collect_callers): Likewise. * ipa-cp.c (create_specialized_node): Adjust. (decide_about_value): Likewise. (decide_whether_version_node): Likewise. * ipa-sra.c (process_isra_node_results): Likewise.
-rw-r--r--gcc/cgraph.c4
-rw-r--r--gcc/cgraph.h2
-rw-r--r--gcc/ipa-cp.c7
-rw-r--r--gcc/ipa-sra.c2
4 files changed, 7 insertions, 8 deletions
diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index d7c78d5..abe4e3e 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -3074,10 +3074,10 @@ collect_callers_of_node_1 (cgraph_node *node, void *data)
/* Collect all callers of cgraph_node and its aliases that are known to lead to
cgraph_node (i.e. are not overwritable). */
-vec<cgraph_edge *>
+auto_vec<cgraph_edge *>
cgraph_node::collect_callers (void)
{
- vec<cgraph_edge *> redirect_callers = vNULL;
+ auto_vec<cgraph_edge *> redirect_callers;
call_for_symbol_thunks_and_aliases (collect_callers_of_node_1,
&redirect_callers, false);
return redirect_callers;
diff --git a/gcc/cgraph.h b/gcc/cgraph.h
index 4a1f899..9f4338f 100644
--- a/gcc/cgraph.h
+++ b/gcc/cgraph.h
@@ -1139,7 +1139,7 @@ struct GTY((tag ("SYMTAB_FUNCTION"))) cgraph_node : public symtab_node
/* Collect all callers of cgraph_node and its aliases that are known to lead
to NODE (i.e. are not overwritable) and that are not thunks. */
- vec<cgraph_edge *> collect_callers (void);
+ auto_vec<cgraph_edge *> collect_callers (void);
/* Remove all callers from the node. */
void remove_callers (void);
diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
index 2cae69e..57c18af 100644
--- a/gcc/ipa-cp.c
+++ b/gcc/ipa-cp.c
@@ -4527,7 +4527,7 @@ create_specialized_node (struct cgraph_node *node,
vec<tree> known_csts,
vec<ipa_polymorphic_call_context> known_contexts,
struct ipa_agg_replacement_value *aggvals,
- vec<cgraph_edge *> callers)
+ vec<cgraph_edge *> &callers)
{
ipa_node_params *new_info, *info = ipa_node_params_sum->get (node);
vec<ipa_replace_map *, va_gc> *replace_trees = NULL;
@@ -4672,7 +4672,6 @@ create_specialized_node (struct cgraph_node *node,
ipcp_discover_new_direct_edges (new_node, known_csts, known_contexts, aggvals);
- callers.release ();
return new_node;
}
@@ -5562,6 +5561,7 @@ decide_about_value (struct cgraph_node *node, int index, HOST_WIDE_INT offset,
offset, val->value));
val->spec_node = create_specialized_node (node, known_csts, known_contexts,
aggvals, callers);
+ callers.release ();
overall_size += val->local_size_cost;
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, " overall size reached %li\n",
@@ -5638,7 +5638,7 @@ decide_whether_version_node (struct cgraph_node *node)
}
struct cgraph_node *clone;
- vec<cgraph_edge *> callers = node->collect_callers ();
+ auto_vec<cgraph_edge *> callers = node->collect_callers ();
for (int i = callers.length () - 1; i >= 0; i--)
{
@@ -5654,7 +5654,6 @@ decide_whether_version_node (struct cgraph_node *node)
/* If node is not called by anyone, or all its caller edges are
self-recursive, the node is not really in use, no need to do
cloning. */
- callers.release ();
info->do_clone_for_all_contexts = false;
return ret;
}
diff --git a/gcc/ipa-sra.c b/gcc/ipa-sra.c
index 3f90d4d..3272daf 100644
--- a/gcc/ipa-sra.c
+++ b/gcc/ipa-sra.c
@@ -3755,7 +3755,7 @@ process_isra_node_results (cgraph_node *node,
unsigned &suffix_counter = clone_num_suffixes->get_or_insert (
IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (
node->decl)));
- vec<cgraph_edge *> callers = node->collect_callers ();
+ auto_vec<cgraph_edge *> callers = node->collect_callers ();
cgraph_node *new_node
= node->create_virtual_clone (callers, NULL, new_adjustments, "isra",
suffix_counter);