From: Evgeny Kudryashov Date: Thu, 21 Sep 2017 12:54:38 +0000 (+0000) Subject: ipa: fix dumping with deleted multiversioning nodes X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9acb459230318eb2f786dc0b974812884a2f3d54;p=gcc.git ipa: fix dumping with deleted multiversioning nodes 2017-09-21 Evgeny Kudryashov * cgraph.c (delete_function_version): New, broken out from... (cgraph_node::delete_function_version): ...here. Rename to cgraph_node::delete_function_version_by_decl. Update all uses. (cgraph_node::remove): Call delete_function_version. From-SVN: r253066 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c743c21f9e8..90dc208d572 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2017-09-21 Evgeny Kudryashov + + * cgraph.c (delete_function_version): New, broken out from... + (cgraph_node::delete_function_version): ...here. Rename to + cgraph_node::delete_function_version_by_decl. Update all uses. + (cgraph_node::remove): Call delete_function_version. + 2017-09-21 Jakub Jelinek PR sanitizer/81715 diff --git a/gcc/cgraph.c b/gcc/cgraph.c index 8bffdec8fb7..3d0cefbd46b 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -190,30 +190,34 @@ cgraph_node::insert_new_function_version (void) return version_info_node; } -/* Remove the cgraph_function_version_info and cgraph_node for DECL. This - DECL is a duplicate declaration. */ -void -cgraph_node::delete_function_version (tree decl) +/* Remove the cgraph_function_version_info node given by DECL_V. */ +static void +delete_function_version (cgraph_function_version_info *decl_v) { - cgraph_node *decl_node = cgraph_node::get (decl); - cgraph_function_version_info *decl_v = NULL; - - if (decl_node == NULL) - return; - - decl_v = decl_node->function_version (); - if (decl_v == NULL) return; if (decl_v->prev != NULL) - decl_v->prev->next = decl_v->next; + decl_v->prev->next = decl_v->next; if (decl_v->next != NULL) decl_v->next->prev = decl_v->prev; if (cgraph_fnver_htab != NULL) cgraph_fnver_htab->remove_elt (decl_v); +} + +/* Remove the cgraph_function_version_info and cgraph_node for DECL. This + DECL is a duplicate declaration. */ +void +cgraph_node::delete_function_version_by_decl (tree decl) +{ + cgraph_node *decl_node = cgraph_node::get (decl); + + if (decl_node == NULL) + return; + + delete_function_version (decl_node->function_version ()); decl_node->remove (); } @@ -1844,6 +1848,7 @@ cgraph_node::remove (void) remove_callers (); remove_callees (); ipa_transforms_to_apply.release (); + delete_function_version (function_version ()); /* Incremental inlining access removed nodes stored in the postorder list. */ diff --git a/gcc/cgraph.h b/gcc/cgraph.h index 7daca1e40cc..1758e8b08c1 100644 --- a/gcc/cgraph.h +++ b/gcc/cgraph.h @@ -1272,7 +1272,7 @@ public: /* Remove the cgraph_function_version_info and cgraph_node for DECL. This DECL is a duplicate declaration. */ - static void delete_function_version (tree decl); + static void delete_function_version_by_decl (tree decl); /* Add the function FNDECL to the call graph. Unlike finalize_function, this function is intended to be used diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 858747eecfc..50fa1ba402e 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -2566,7 +2566,7 @@ next_arg:; DECL_FUNCTION_VERSIONED (newdecl) = 1; /* newdecl will be purged after copying to olddecl and is no longer a version. */ - cgraph_node::delete_function_version (newdecl); + cgraph_node::delete_function_version_by_decl (newdecl); } if (TREE_CODE (newdecl) == FUNCTION_DECL)