diff options
author | Martin Jambor <mjambor@suse.cz> | 2019-03-07 17:03:34 +0100 |
---|---|---|
committer | Martin Jambor <jamborm@gcc.gnu.org> | 2019-03-07 17:03:34 +0100 |
commit | 1738b52201b1ce28c9f869646f5412b8937ccfe6 (patch) | |
tree | cdb71e52faf06fd59ef5c90c4cebf832ea238b09 /gcc/cgraph.c | |
parent | 606711a1671cc63713b893c4557df967a5a6ac20 (diff) | |
download | gcc-1738b52201b1ce28c9f869646f5412b8937ccfe6.zip gcc-1738b52201b1ce28c9f869646f5412b8937ccfe6.tar.gz gcc-1738b52201b1ce28c9f869646f5412b8937ccfe6.tar.bz2 |
Relax cgraph_node::clone_of_p to also look through former clones
2019-03-07 Martin Jambor <mjambor@suse.cz>
PR ipa/88235
* cgraph.h (cgraph_node): New inline method former_thunk_p.
* cgraph.c (cgraph_node::dump): Dump a note if node is a former thunk.
(clone_of_p): Treat expanded thunks like thunks, be optimistic if they
have multiple callees. At the end check if declarations match as
opposed to cgraph_nodes.
testsuite/
* g++.dg/ipa/pr88235.C: New test.
From-SVN: r269462
Diffstat (limited to 'gcc/cgraph.c')
-rw-r--r-- | gcc/cgraph.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/gcc/cgraph.c b/gcc/cgraph.c index dfe1833..9f0d603 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -2109,6 +2109,8 @@ cgraph_node::dump (FILE *f) (int)thunk.indirect_offset, (int)thunk.virtual_offset_p); } + else if (former_thunk_p ()) + fprintf (f, " Former thunk"); if (alias && thunk.alias && DECL_P (thunk.alias)) { @@ -2963,7 +2965,9 @@ cgraph_node::collect_callers (void) return redirect_callers; } -/* Return TRUE if NODE2 a clone of NODE or is equivalent to it. */ + +/* Return TRUE if NODE2 a clone of NODE or is equivalent to it. Return + optimistically true if this cannot be determined. */ static bool clone_of_p (cgraph_node *node, cgraph_node *node2) @@ -2975,12 +2979,17 @@ clone_of_p (cgraph_node *node, cgraph_node *node2) /* There are no virtual clones of thunks so check former_clone_of or if we might have skipped thunks because this adjustments are no longer necessary. */ - while (node->thunk.thunk_p) + while (node->thunk.thunk_p || node->former_thunk_p ()) { if (node2->former_clone_of == node->decl) return true; if (!node->thunk.this_adjusting) return false; + /* In case of instrumented expanded thunks, which can have multiple calls + in them, we do not know how to continue and just have to be + optimistic. */ + if (node->callees->next_callee) + return true; node = node->callees->callee->ultimate_alias_target (); skipped_thunk = true; } @@ -2996,7 +3005,7 @@ clone_of_p (cgraph_node *node, cgraph_node *node2) return false; } - while (node != node2 && node2) + while (node2 && node->decl != node2->decl) node2 = node2->clone_of; return node2 != NULL; } |