aboutsummaryrefslogtreecommitdiff
path: root/gcc/ipa-cp.c
diff options
context:
space:
mode:
authorMichael Ploujnikov <michael.ploujnikov@oracle.com>2018-11-30 22:27:11 +0000
committerMichael Ploujnikov <plouj@gcc.gnu.org>2018-11-30 22:27:11 +0000
commit53aedcce09b10467e60b9717223191f28e0360a3 (patch)
treec72d1dda4f4a1aa9ddf8b49d3b4e9c31949ec228 /gcc/ipa-cp.c
parentb75255a9b11ae672e569966860090d70ff10ffca (diff)
downloadgcc-53aedcce09b10467e60b9717223191f28e0360a3.zip
gcc-53aedcce09b10467e60b9717223191f28e0360a3.tar.gz
gcc-53aedcce09b10467e60b9717223191f28e0360a3.tar.bz2
Minimize clone counter memory usage in create_virtual_clone.
Based on Martin Jambour's suggestion: https://gcc.gnu.org/ml/gcc-patches/2018-09/msg00111.html gcc: * cgraph.h (clone_function_name): Add a variant that takes a tree decl. * cgraph.h (cgraph_node::create_virtual_clone): Add a new argument: num_suffix. * cgraphclones.c (cgraph_node::create_virtual_clone): Pass num_suffix to clone_function_name. (clone_function_name): Add a variant that takes a tree decl. * ipa-cp.c (create_specialized_node): Keep track of clone counters in clone_num_suffixes hash map. (ipcp_driver): Free the counter hash map. * ipa-hsa.c (process_hsa_functions): Creates at most one hsa clone per function. From-SVN: r266692
Diffstat (limited to 'gcc/ipa-cp.c')
-rw-r--r--gcc/ipa-cp.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
index 6b9dc8c..84ca688 100644
--- a/gcc/ipa-cp.c
+++ b/gcc/ipa-cp.c
@@ -376,6 +376,9 @@ static profile_count max_count;
static long overall_size, max_new_size;
+/* Node to unique clone suffix number map. */
+static hash_map<cgraph_node *, unsigned> *clone_num_suffixes;
+
/* Return the param lattices structure corresponding to the Ith formal
parameter of the function described by INFO. */
static inline struct ipcp_param_lattices *
@@ -3829,8 +3832,11 @@ create_specialized_node (struct cgraph_node *node,
}
}
+ unsigned &suffix_counter = clone_num_suffixes->get_or_insert (node);
new_node = node->create_virtual_clone (callers, replace_trees,
- args_to_skip, "constprop");
+ args_to_skip, "constprop",
+ suffix_counter);
+ suffix_counter++;
bool have_self_recursive_calls = !self_recursive_calls.is_empty ();
for (unsigned j = 0; j < self_recursive_calls.length (); j++)
@@ -5044,6 +5050,7 @@ ipcp_driver (void)
ipa_check_create_node_params ();
ipa_check_create_edge_args ();
+ clone_num_suffixes = new hash_map<cgraph_node *, unsigned>;
if (dump_file)
{
@@ -5065,6 +5072,7 @@ ipcp_driver (void)
ipcp_store_vr_results ();
/* Free all IPCP structures. */
+ delete clone_num_suffixes;
free_toporder_info (&topo);
delete edge_clone_summaries;
edge_clone_summaries = NULL;