diff options
author | Ilya Enkovich <ilya.enkovich@intel.com> | 2014-12-09 08:00:52 +0000 |
---|---|---|
committer | Ilya Enkovich <ienkovich@gcc.gnu.org> | 2014-12-09 08:00:52 +0000 |
commit | 6c77972738e8a6abac2b716a1b14c459b4c51240 (patch) | |
tree | aaafbd6893bb320d7e43d58e992f19015ce6cb24 /gcc/lto | |
parent | 6a73516d838ce30e52f576df0dee882e410038b3 (diff) | |
download | gcc-6c77972738e8a6abac2b716a1b14c459b4c51240.zip gcc-6c77972738e8a6abac2b716a1b14c459b4c51240.tar.gz gcc-6c77972738e8a6abac2b716a1b14c459b4c51240.tar.bz2 |
lto-partition.c (privatize_symbol_name): Correctly privatize instrumentation clones.
gcc/
* lto/lto-partition.c (privatize_symbol_name): Correctly
privatize instrumentation clones.
gcc/testsuite/
* gcc.dg/lto/lto.exp: Load mpx-dg.exp.
* gcc.dg/lto/chkp-privatize_0.c: New.
* gcc.dg/lto/chkp-privatize_1.c: New.
From-SVN: r218508
Diffstat (limited to 'gcc/lto')
-rw-r--r-- | gcc/lto/lto-partition.c | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/gcc/lto/lto-partition.c b/gcc/lto/lto-partition.c index 65f0582..809a493 100644 --- a/gcc/lto/lto-partition.c +++ b/gcc/lto/lto-partition.c @@ -787,8 +787,16 @@ static bool privatize_symbol_name (symtab_node *node) { tree decl = node->decl; - const char *name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)); - cgraph_node *cnode; + cgraph_node *cnode = dyn_cast <cgraph_node *> (node); + const char *name; + + /* If we want to privatize instrumentation clone + then we need to change original function name + which is used via transparent alias chain. */ + if (cnode && cnode->instrumentation_clone) + decl = cnode->orig_decl; + + name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)); /* Our renaming machinery do not handle more than one change of assembler name. We should not need more than one anyway. */ @@ -821,15 +829,20 @@ privatize_symbol_name (symtab_node *node) (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) + if (cnode) { - tree iname = DECL_ASSEMBLER_NAME (cnode->instrumented_version->decl); - - gcc_assert (IDENTIFIER_TRANSPARENT_ALIAS (iname)); - TREE_CHAIN (iname) = DECL_ASSEMBLER_NAME (decl); + tree iname = NULL_TREE; + if (cnode->instrumentation_clone) + iname = DECL_ASSEMBLER_NAME (cnode->decl); + else if (cnode->instrumented_version + && cnode->instrumented_version->orig_decl == decl) + iname = DECL_ASSEMBLER_NAME (cnode->instrumented_version->decl); + + if (iname) + { + gcc_assert (IDENTIFIER_TRANSPARENT_ALIAS (iname)); + TREE_CHAIN (iname) = DECL_ASSEMBLER_NAME (decl); + } } if (symtab->dump_file) fprintf (symtab->dump_file, |