This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Improve inlining heuristics via estimate_num_insns
- From: Richard Guenther <richard dot guenther at gmail dot com>
- To: Richard Guenther <rguenth at tat dot physik dot uni-tuebingen dot de>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 25 Feb 2005 22:13:47 +0100
- Subject: Re: [PATCH] Improve inlining heuristics via estimate_num_insns
- References: <421E5B10.2050805@tat.physik.uni-tuebingen.de>
- Reply-to: Richard Guenther <richard dot guenther at gmail dot com>
On Thu, 24 Feb 2005 23:54:08 +0100, Richard Guenther
<rguenth@tat.physik.uni-tuebingen.de> wrote:
> Hi!
>
> This patch improves inlining heuristics by tweaking estimate_num_insns
> to return numbers that
> 1. are more close to those of gcc 3.4
> 2. do not penaltize abstraction. I.e. the size estimate results in
> inline int foo(int x) { return x*x; }
> int bar(int x) { return foo(x); }
> having the same sizes (actually 1) if foo is inlined in bar.
Maybe I should add how the patch accomplishes this. The patched
estimate_num_insns simply ignores all stores to artificially created
variables - those are the main difference of the initial trees compared to 3.4.
This way we also don't count return statements twice and fail to remove the
return cost after inlining. Generally, based on my own tests, the new
way of counting results in a bit lower function size estimates compared to
3.4. Also for the usual C code the compile time impact is zero, for C++ code
that suffered from performance regressions and are now fixed it can cause
quite some compile-time increase - but previously we were just hiding us
being slower by not inlining (and thus creating performance regressions).
Richard.