aboutsummaryrefslogtreecommitdiff
path: root/gcc/lto
diff options
context:
space:
mode:
authorMichael Ploujnikov <michael.ploujnikov@oracle.com>2018-11-30 22:31:02 +0000
committerMichael Ploujnikov <plouj@gcc.gnu.org>2018-11-30 22:31:02 +0000
commited1b53a0abc298f13a89e2bb69cbedfb5c4dd6f9 (patch)
tree222600136b4207ba97103ad844539d07b6e32260 /gcc/lto
parent53aedcce09b10467e60b9717223191f28e0360a3 (diff)
downloadgcc-ed1b53a0abc298f13a89e2bb69cbedfb5c4dd6f9.zip
gcc-ed1b53a0abc298f13a89e2bb69cbedfb5c4dd6f9.tar.gz
gcc-ed1b53a0abc298f13a89e2bb69cbedfb5c4dd6f9.tar.bz2
Minimize clone counter memory usage in LTO.
gcc/lto: * lto-partition.c (privatize_symbol_name_1): Keep track of non-unique symbol counters in the lto_clone_numbers hash map. (lto_promote_cross_file_statics): Allocate and free the lto_clone_numbers hash map. (lto_promote_statics_nonwpa): Free the lto_clone_numbers hash map. From-SVN: r266693
Diffstat (limited to 'gcc/lto')
-rw-r--r--gcc/lto/ChangeLog11
-rw-r--r--gcc/lto/lto-partition.c15
2 files changed, 24 insertions, 2 deletions
diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog
index ca998df..7b9846c 100644
--- a/gcc/lto/ChangeLog
+++ b/gcc/lto/ChangeLog
@@ -1,3 +1,14 @@
+2018-11-30 Michael Ploujnikov <michael.ploujnikov@oracle.com>
+
+ Minimize clone counter memory usage in LTO.
+ * lto-partition.c (privatize_symbol_name_1): Keep track of
+ non-unique symbol counters in the lto_clone_numbers hash
+ map.
+ (lto_promote_cross_file_statics): Allocate and free the
+ lto_clone_numbers hash map.
+ (lto_promote_statics_nonwpa): Free the lto_clone_numbers hash
+ map.
+
2018-11-28 Jan Hubicka <jh@suse.cz>
* lto.c (lto_read_decls): Fix handling of INTEGER_CST.
diff --git a/gcc/lto/lto-partition.c b/gcc/lto/lto-partition.c
index 24e7c238..867f075 100644
--- a/gcc/lto/lto-partition.c
+++ b/gcc/lto/lto-partition.c
@@ -951,6 +951,9 @@ validize_symbol_for_target (symtab_node *node)
}
}
+/* Maps symbol names to unique lto clone counters. */
+static hash_map<const char *, unsigned> *lto_clone_numbers;
+
/* Helper for privatize_symbol_name. Mangle NODE symbol name
represented by DECL. */
@@ -963,9 +966,11 @@ privatize_symbol_name_1 (symtab_node *node, tree decl)
return false;
name = maybe_rewrite_identifier (name);
+ unsigned &clone_number = lto_clone_numbers->get_or_insert (name);
symtab->change_decl_assembler_name (decl,
- clone_function_name_numbered (
- name, "lto_priv"));
+ clone_function_name (
+ name, "lto_priv", clone_number));
+ clone_number++;
if (node->lto_file_data)
lto_record_renamed_decl (node->lto_file_data, name,
@@ -1157,6 +1162,8 @@ lto_promote_cross_file_statics (void)
part->encoder = compute_ltrans_boundary (part->encoder);
}
+ lto_clone_numbers = new hash_map<const char *, unsigned>;
+
/* Look at boundaries and promote symbols as needed. */
for (i = 0; i < n_sets; i++)
{
@@ -1187,6 +1194,7 @@ lto_promote_cross_file_statics (void)
promote_symbol (node);
}
}
+ delete lto_clone_numbers;
}
/* Rename statics in the whole unit in the case that
@@ -1196,9 +1204,12 @@ void
lto_promote_statics_nonwpa (void)
{
symtab_node *node;
+
+ lto_clone_numbers = new hash_map<const char *, unsigned>;
FOR_EACH_SYMBOL (node)
{
rename_statics (NULL, node);
validize_symbol_for_target (node);
}
+ delete lto_clone_numbers;
}