diff options
author | jamborm <jamborm@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-07-07 18:08:00 +0000 |
---|---|---|
committer | jamborm <jamborm@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-07-07 18:08:00 +0000 |
commit | 2f9d66d39bfddf11196934d86e0799364a816217 (patch) | |
tree | 8159ccb5866dbd028e5b0afeb4995c90cc5024a0 /gcc/cgraphunit.c | |
parent | e49e84133e34978718575b7ae2e6c976588c217c (diff) |
2011-07-07 Martin Jambor <mjambor@suse.cz>
PR middle-end/49495
* cgraphunit.c (verify_edge_corresponds_to_fndecl): New function.
(verify_cgraph_node): Some functinality moved to
verify_edge_corresponds_to_fndecl, call it.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@175998 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cgraphunit.c')
-rw-r--r-- | gcc/cgraphunit.c | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c index e470d85acc6..2414d86695f 100644 --- a/gcc/cgraphunit.c +++ b/gcc/cgraphunit.c @@ -450,6 +450,28 @@ cgraph_debug_gimple_stmt (struct function *this_cfun, gimple stmt) debug_gimple_stmt (stmt); } +/* Verify that call graph edge E corresponds to DECL from the associated + statement. Return true if the verification should fail. */ + +static bool +verify_edge_corresponds_to_fndecl (struct cgraph_edge *e, tree decl) +{ + if (!e->callee->global.inlined_to + && decl + && cgraph_get_node (decl) + && (e->callee->former_clone_of + != cgraph_function_or_thunk_node (cgraph_get_node (decl), NULL)->decl) + /* IPA-CP sometimes redirect edge to clone and then back to the former + function. This ping-pong has to go, eventaully. */ + && (cgraph_function_or_thunk_node (cgraph_get_node (decl), NULL) + != cgraph_function_or_thunk_node (e->callee, NULL)) + && !clone_of_p (cgraph_get_node (decl), + e->callee)) + return true; + else + return false; +} + /* Verify cgraph nodes of given cgraph node. */ DEBUG_FUNCTION void verify_cgraph_node (struct cgraph_node *node) @@ -702,17 +724,7 @@ verify_cgraph_node (struct cgraph_node *node) } if (!e->indirect_unknown_callee) { - if (!e->callee->global.inlined_to - && decl - && cgraph_get_node (decl) - && (e->callee->former_clone_of - != cgraph_get_node (decl)->decl) - /* IPA-CP sometimes redirect edge to clone and then back to the former - function. This ping-pong has to go, eventaully. */ - && (cgraph_function_or_thunk_node (cgraph_get_node (decl), NULL) - != cgraph_function_or_thunk_node (e->callee, NULL)) - && !clone_of_p (cgraph_get_node (decl), - e->callee)) + if (verify_edge_corresponds_to_fndecl (e, decl)) { error ("edge points to wrong declaration:"); debug_tree (e->callee->decl); |