Discussion:
[patch] Work harder to find DECL_STRUCT_FUNCTION
Eric Botcazou
2014-10-06 09:52:24 UTC
Permalink
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 <***@adacore.com>

* ipa-inline.c (can_inline_edge_p): Recurse on clones to find the
DECL_STRUCT_FUNCTION of the original node.
--
Eric Botcazou
Richard Biener
2014-10-06 11:30:49 UTC
Permalink
Post by Eric Botcazou
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?
I wonder if this is worth abstracting into a callee_fn () cgraph edge method?

Honzas call.

Thanks,
Richard.
Post by Eric Botcazou
* ipa-inline.c (can_inline_edge_p): Recurse on clones to find the
DECL_STRUCT_FUNCTION of the original node.
--
Eric Botcazou
Eric Botcazou
2014-10-07 07:43:36 UTC
Permalink
Post by Richard Biener
I wonder if this is worth abstracting into a callee_fn () cgraph edge method?
That would rather be a cgraph node method without "callee" in the name since
we also apply it to callers, something like:

struct function *cgraph_node::cfun (void)

and the code in can_inline_edge_p would just be:

struct function *caller_cfun = e->caller->cfun ();
struct function *callee_cfun = callee ? callee->cfun () : NULL;
--
Eric Botcazou
Richard Biener
2014-10-07 07:51:52 UTC
Permalink
Post by Eric Botcazou
Post by Richard Biener
I wonder if this is worth abstracting into a callee_fn () cgraph edge method?
That would rather be a cgraph node method without "callee" in the name since
struct function *cgraph_node::cfun (void)
struct function *caller_cfun = e->caller->cfun ();
struct function *callee_cfun = callee ? callee->cfun () : NULL;
Ah, ok. Yes agreed - but without the 'c' (nothing is "current" here IMHO).
Maybe ->get_fun () to be consistent with other method names.

I'll pre-approve a patch to do that.

Thanks,
Richard.
Post by Eric Botcazou
--
Eric Botcazou
Jan Hubicka
2014-10-07 17:41:16 UTC
Permalink
Post by Richard Biener
Post by Eric Botcazou
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?
I wonder if this is worth abstracting into a callee_fn () cgraph edge method?
Honzas call.
I would rather fix can_inline_edge_p to not use DECL_STRUCT_FUNCTION - it is not
available during WPA and thus all the code using it is wrong. The
non_call_exceptions code has FIXME explaining that, I see that someone added cilk.
It should be easy to move these flags to cgraph node itself - originally I did not
want to duplicate it and worried about performance implications.

Honza
Post by Richard Biener
Thanks,
Richard.
Post by Eric Botcazou
* ipa-inline.c (can_inline_edge_p): Recurse on clones to find the
DECL_STRUCT_FUNCTION of the original node.
--
Eric Botcazou
Loading...