This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Improve inlining heuristics via estimate_num_insns


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]