aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2014-04-14 19:18:54 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2014-04-14 17:18:54 +0000
commitcb90235dad713561e78ca7dd929218f22919cd24 (patch)
tree194491cc20ba14600662056b4a34f745b09db2e6 /gcc
parent7b3b340eafc59df1e79b9cb231722ea2507f04c7 (diff)
downloadgcc-cb90235dad713561e78ca7dd929218f22919cd24.zip
gcc-cb90235dad713561e78ca7dd929218f22919cd24.tar.gz
gcc-cb90235dad713561e78ca7dd929218f22919cd24.tar.bz2
ipa-utils.c (ipa_merge_profiles): Merge profile_id.
* ipa-utils.c (ipa_merge_profiles): Merge profile_id. * coverage.c (coverage_compute_profile_id): Handle externally visible symbols. * lto/lto-symtab.c (lto_cgraph_replace_node): Don't re-merge tp_first_run. From-SVN: r209387
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/coverage.c33
-rw-r--r--gcc/ipa-utils.c8
-rw-r--r--gcc/lto/ChangeLog5
-rw-r--r--gcc/lto/lto-symtab.c6
5 files changed, 41 insertions, 17 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e641c6e..26d8d33 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2014-04-14 Jan Hubicka <hubicka@ucw.cz>
+
+ * ipa-utils.c (ipa_merge_profiles): Merge profile_id.
+ * coverage.c (coverage_compute_profile_id): Handle externally visible
+ symbols.
+
2014-04-14 Martin Jambor <mjambor@suse.cz>
* tree-sra.c (ipa_sra_preliminary_function_checks): Skip
diff --git a/gcc/coverage.c b/gcc/coverage.c
index 4c06fa4..ff1e67d 100644
--- a/gcc/coverage.c
+++ b/gcc/coverage.c
@@ -555,18 +555,29 @@ coverage_compute_lineno_checksum (void)
unsigned
coverage_compute_profile_id (struct cgraph_node *n)
{
- expanded_location xloc
- = expand_location (DECL_SOURCE_LOCATION (n->decl));
- unsigned chksum = xloc.line;
+ unsigned chksum;
- chksum = coverage_checksum_string (chksum, xloc.file);
- chksum = coverage_checksum_string
- (chksum, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (n->decl)));
- if (first_global_object_name)
- chksum = coverage_checksum_string
- (chksum, first_global_object_name);
- chksum = coverage_checksum_string
- (chksum, aux_base_name);
+ /* Externally visible symbols have unique name. */
+ if (TREE_PUBLIC (n->decl) || DECL_EXTERNAL (n->decl))
+ {
+ chksum = coverage_checksum_string
+ (0, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (n->decl)));
+ }
+ else
+ {
+ expanded_location xloc
+ = expand_location (DECL_SOURCE_LOCATION (n->decl));
+
+ chksum = xloc.line;
+ chksum = coverage_checksum_string (chksum, xloc.file);
+ chksum = coverage_checksum_string
+ (chksum, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (n->decl)));
+ if (first_global_object_name)
+ chksum = coverage_checksum_string
+ (chksum, first_global_object_name);
+ chksum = coverage_checksum_string
+ (chksum, aux_base_name);
+ }
/* Non-negative integers are hopefully small enough to fit in all targets. */
return chksum & 0x7fffffff;
diff --git a/gcc/ipa-utils.c b/gcc/ipa-utils.c
index dccecb1..8e7c7cb 100644
--- a/gcc/ipa-utils.c
+++ b/gcc/ipa-utils.c
@@ -660,6 +660,14 @@ ipa_merge_profiles (struct cgraph_node *dst,
if (dst->tp_first_run > src->tp_first_run && src->tp_first_run)
dst->tp_first_run = src->tp_first_run;
+ if (src->profile_id)
+ {
+ if (!dst->profile_id)
+ dst->profile_id = src->profile_id;
+ else
+ gcc_assert (src->profile_id == dst->profile_id);
+ }
+
if (!dst->count)
return;
if (cgraph_dump_file)
diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog
index 2a7d863..4200a47 100644
--- a/gcc/lto/ChangeLog
+++ b/gcc/lto/ChangeLog
@@ -1,3 +1,8 @@
+2014-04-14 Jan Hubicka <hubicka@ucw.cz>
+
+ * lto/lto-symtab.c (lto_cgraph_replace_node): Don't re-merge
+ tp_first_run.
+
2014-03-19 Jan Hubicka <hubicka@ucw.cz>
* lto.c: Include ipa-inline.h
diff --git a/gcc/lto/lto-symtab.c b/gcc/lto/lto-symtab.c
index 71242c8..8c83d3c 100644
--- a/gcc/lto/lto-symtab.c
+++ b/gcc/lto/lto-symtab.c
@@ -91,12 +91,6 @@ lto_cgraph_replace_node (struct cgraph_node *node,
if (node->decl != prevailing_node->decl)
cgraph_release_function_body (node);
- /* Time profile merging */
- if (node->tp_first_run)
- prevailing_node->tp_first_run = prevailing_node->tp_first_run ?
- MIN (prevailing_node->tp_first_run, node->tp_first_run) :
- node->tp_first_run;
-
/* Finally remove the replaced node. */
cgraph_remove_node (node);
}