summaryrefslogtreecommitdiff
path: root/gcc/lto-cgraph.c
diff options
context:
space:
mode:
authorIlya Enkovich <ilya.enkovich@intel.com>2014-12-09 07:56:26 +0000
committerIlya Enkovich <ienkovich@gcc.gnu.org>2014-12-09 07:56:26 +0000
commit6a73516d838ce30e52f576df0dee882e410038b3 (patch)
tree5ece19a9325a63309c49cb7f1c6ea6047a1b7aa4 /gcc/lto-cgraph.c
parent227eabce47178c49601a13b801cca57d41494b8f (diff)
lto-cgraph.c (input_cgraph_1): Don't break existing instrumentation clone references.
* lto-cgraph.c (input_cgraph_1): Don't break existing instrumentation clone references. * lto/lto-symtab.c (lto_cgraph_replace_node): Redirect instrumented_version references appropriately. From-SVN: r218507
Diffstat (limited to 'gcc/lto-cgraph.c')
-rw-r--r--gcc/lto-cgraph.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c
index d424e145474..b310b446808 100644
--- a/gcc/lto-cgraph.c
+++ b/gcc/lto-cgraph.c
@@ -1562,7 +1562,18 @@ input_cgraph_1 (struct lto_file_decl_data *file_data,
cnode->instrumented_version = cgraph_node::get (cnode->orig_decl);
if (cnode->instrumented_version)
- cnode->instrumented_version->instrumented_version = cnode;
+ {
+ /* We may have multiple nodes for a single function which
+ will be merged later. To have a proper merge we need
+ to keep instrumentation_version reference between nodes
+ consistent: each instrumented_version reference should
+ have proper reverse reference. Thus don't break existing
+ instrumented_version reference if it already exists. */
+ if (cnode->instrumented_version->instrumented_version)
+ cnode->instrumented_version = NULL;
+ else
+ cnode->instrumented_version->instrumented_version = cnode;
+ }
/* Restore decl names reference. */
if (IDENTIFIER_TRANSPARENT_ALIAS (DECL_ASSEMBLER_NAME (cnode->decl))