This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH/RFC] Improve inlining heuristics for 4.0
- From: Richard Guenther <rguenth at tat dot physik dot uni-tuebingen dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 24 Feb 2005 17:57:05 +0100 (CET)
- Subject: Re: [PATCH/RFC] Improve inlining heuristics for 4.0
On Thu, 24 Feb 2005, Richard Guenther wrote:
> Hi!
>
> This is a simple attempt to improve inlining heuristics for 4.0
> while keeping in mind that for 4.1 this will be all done very
> differently.
[...]
> 2. For code like
> inline int foo(void) { return 0; }
> int foo1(void) { return foo(); }
> we do not honour the removed cost of initializing a temporary
> for the result of the function call to foo.
> The fix is to subtract the cost of the MODIFY_EXPR (..., CALL_EXPR)
> in the caller if inlining the call. We have a cost for this
> initialization in the inlined function anyway.
It seems this breaks code like
typedef struct { int i; } t;
inline
y(t u)
{}
x()
{
t u;
y(u);
}
(aka c-torture/compile/920501-13)
where we get negative size for x after inlining. I'll need to find
a way to detect if we are in fact ignoring the return value of a
function. Is there an easy way to do so?
Richard.