diff options
Diffstat (limited to 'gcc/lto')
-rw-r--r-- | gcc/lto/lto-partition.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/gcc/lto/lto-partition.c b/gcc/lto/lto-partition.c index c38931b3f95..0e1a95bf918 100644 --- a/gcc/lto/lto-partition.c +++ b/gcc/lto/lto-partition.c @@ -108,8 +108,9 @@ add_references_to_partition (ltrans_partition part, symtab_node *node) Recursively look into the initializers of the constant variable and add references, too. */ else if (is_a <varpool_node *> (ref->referred) - && dyn_cast <varpool_node *> (ref->referred) - ->ctor_useable_for_folding_p () + && (dyn_cast <varpool_node *> (ref->referred) + ->ctor_useable_for_folding_p () + || POINTER_BOUNDS_P (ref->referred->decl)) && !lto_symtab_encoder_in_partition_p (part->encoder, ref->referred)) { if (!part->initializers_visited) @@ -176,6 +177,11 @@ add_symbol_to_partition_1 (ltrans_partition part, symtab_node *node) for (e = cnode->callers; e; e = e->next_caller) if (e->caller->thunk.thunk_p) add_symbol_to_partition_1 (part, e->caller); + + /* Instrumented version is actually the same function. + Therefore put it into the same partition. */ + if (cnode->instrumented_version) + add_symbol_to_partition_1 (part, cnode->instrumented_version); } add_references_to_partition (part, node); @@ -782,6 +788,7 @@ privatize_symbol_name (symtab_node *node) { tree decl = node->decl; const char *name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)); + cgraph_node *cnode; /* Our renaming machinery do not handle more than one change of assembler name. We should not need more than one anyway. */ @@ -812,6 +819,18 @@ privatize_symbol_name (symtab_node *node) lto_record_renamed_decl (node->lto_file_data, name, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl))); + /* We could change name which is a target of transparent alias + chain of instrumented function name. Fix alias chain if so .*/ + if ((cnode = dyn_cast <cgraph_node *> (node)) + && !cnode->instrumentation_clone + && cnode->instrumented_version + && cnode->instrumented_version->orig_decl == decl) + { + tree iname = DECL_ASSEMBLER_NAME (cnode->instrumented_version->decl); + + gcc_assert (IDENTIFIER_TRANSPARENT_ALIAS (iname)); + TREE_CHAIN (iname) = DECL_ASSEMBLER_NAME (decl); + } if (symtab->dump_file) fprintf (symtab->dump_file, "Privatizing symbol name: %s -> %s\n", |