Hi,
you can have chains of clone functions in the callgraph but can_inline_edge_p
stops at the first clone when it is looking for DECL_STRUCT_FUNCTION, which
can fool the following conditions in the predicate.
Tested on x86_64-suse-linux, OK for the mainline?
2014-10-06 Eric Botcazou <ebotca...@adacore.com>
* ipa-inline.c (can_inline_edge_p): Recurse on clones to find the
DECL_STRUCT_FUNCTION of the original node.
--
Eric Botcazou
Index: ipa-inline.c
===================================================================
--- ipa-inline.c (revision 215843)
+++ ipa-inline.c (working copy)
@@ -276,12 +276,24 @@ can_inline_edge_p (struct cgraph_edge *e
struct function *caller_cfun = DECL_STRUCT_FUNCTION (e->caller->decl);
struct function *callee_cfun
= callee ? DECL_STRUCT_FUNCTION (callee->decl) : NULL;
+ struct cgraph_node *n;
- if (!caller_cfun && e->caller->clone_of)
- caller_cfun = DECL_STRUCT_FUNCTION (e->caller->clone_of->decl);
+ n = e->caller;
+ while (!caller_cfun && n->clone_of)
+ {
+ n = n->clone_of;
+ caller_cfun = DECL_STRUCT_FUNCTION (n->decl);
+ }
- if (!callee_cfun && callee && callee->clone_of)
- callee_cfun = DECL_STRUCT_FUNCTION (callee->clone_of->decl);
+ if (callee)
+ {
+ n = callee;
+ while (!callee_cfun && n->clone_of)
+ {
+ n = n->clone_of;
+ callee_cfun = DECL_STRUCT_FUNCTION (n->decl);
+ }
+ }
gcc_assert (e->inline_failed);