aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2013-08-29 19:52:33 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2013-08-29 19:52:33 +0000
commit440a50821263f118d1b7c424e5506670a67a6e6b (patch)
treee098e4a02db951f24d600b0dfbec08c4612e15d1
parent6e39ee0c0b95557ac2765acdd6ca7de98dba856b (diff)
downloadgcc-440a50821263f118d1b7c424e5506670a67a6e6b.zip
gcc-440a50821263f118d1b7c424e5506670a67a6e6b.tar.gz
gcc-440a50821263f118d1b7c424e5506670a67a6e6b.tar.bz2
cgraphclones.c (cgraph_create_virtual_clone): Compute the DECL_NAME of the clone from the DECL_NAME of the original function.
* cgraphclones.c (cgraph_create_virtual_clone): Compute the DECL_NAME of the clone from the DECL_NAME of the original function. From-SVN: r202086
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/cgraphclones.c14
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ipa-cp-1.c2
4 files changed, 20 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c5ffead..f254cd0 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2013-08-29 Eric Botcazou <ebotcazou@adacore.com>
+
+ * cgraphclones.c (cgraph_create_virtual_clone): Compute the DECL_NAME
+ of the clone from the DECL_NAME of the original function.
+
2013-08-29 Oleg Endo <olegendo@gcc.gnu.org>
* passes.c (register_pass): Add overload.
diff --git a/gcc/cgraphclones.c b/gcc/cgraphclones.c
index ae26a02..54b97b9 100644
--- a/gcc/cgraphclones.c
+++ b/gcc/cgraphclones.c
@@ -252,7 +252,7 @@ cgraph_clone_node (struct cgraph_node *n, tree decl, gcov_type count, int freq,
return new_node;
}
-/* Create a new name for clone of DECL, add SUFFIX. Returns an identifier. */
+/* Return a new assembler name for a clone of DECL with SUFFIX. */
static GTY(()) unsigned int clone_fn_id_num;
@@ -293,8 +293,9 @@ cgraph_create_virtual_clone (struct cgraph_node *old_node,
tree old_decl = old_node->symbol.decl;
struct cgraph_node *new_node = NULL;
tree new_decl;
- size_t i;
+ size_t len, i;
struct ipa_replace_map *map;
+ char *name;
if (!in_lto_p)
gcc_checking_assert (tree_versionable_function_p (old_decl));
@@ -318,8 +319,13 @@ cgraph_create_virtual_clone (struct cgraph_node *old_node,
sometimes storing only clone decl instead of original. */
/* Generate a new name for the new version. */
- DECL_NAME (new_decl) = clone_function_name (old_decl, suffix);
- SET_DECL_ASSEMBLER_NAME (new_decl, DECL_NAME (new_decl));
+ len = IDENTIFIER_LENGTH (DECL_NAME (old_decl));
+ name = XALLOCAVEC (char, len + strlen (suffix) + 2);
+ memcpy (name, IDENTIFIER_POINTER (DECL_NAME (old_decl)), len);
+ strcpy (name + len + 1, suffix);
+ name[len] = '.';
+ DECL_NAME (new_decl) = get_identifier (name);
+ SET_DECL_ASSEMBLER_NAME (new_decl, clone_function_name (old_decl, suffix));
SET_DECL_RTL (new_decl, NULL);
new_node = cgraph_clone_node (old_node, new_decl, old_node->count,
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 1f34c2d..96259ea 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2013-08-29 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc.dg/tree-ssa/ipa-cp-1.c: Adjust regexp.
+
2013-08-29 Richard Biener <rguenther@suse.de>
PR tree-optimization/58246
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ipa-cp-1.c b/gcc/testsuite/gcc.dg/tree-ssa/ipa-cp-1.c
index 5d087aa..ec628b7 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ipa-cp-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ipa-cp-1.c
@@ -16,5 +16,5 @@ blah ()
very_long_function (1);
}
/* One appearance for dump, one self recursive call and one call from main. */
-/* { dg-final { scan-tree-dump-times "very_long_function.constprop.0 \\(\\)" 3 "optimized"} } */
+/* { dg-final { scan-tree-dump-times "very_long_function.constprop \\(\\)" 3 "optimized"} } */
/* { dg-final { cleanup-tree-dump "optimized" } } */