This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: unexpected speedup by manual inlining
On Tue, Oct 28, 2008 at 11:07:10AM -0600, Andrew Bell wrote:
> On Tue, Oct 28, 2008 at 7:23 AM, Rohit Garg <rpg.314@gmail.com> wrote:
> > Hi all,
> >
> > I have a small app. In it in a a particular place, I had a 2-3
> > functions being called from one main function. They were small
> > functions (5-6 lines) and inline keyword was used. The performance was
> > ......... HORRIBLE.
> >
> > -Winline didn't report any case of a function not being inlined.
>
> Perhaps this is suggesting the obvious, but gcc doesn't do inlining if
> you aren't compiling with optimization. You get no warning in this
> case from -Winline.
And use -O3 optimization if you want the compiler to consider to do the inline
automatically. If the function is still not being inlined, you can often tweak
various parameters via --param to get the function inlined. Note, older
versions of GCC would only inline a function if the function definition
occurred before the use of the function.
--
Michael Meissner, IBM
4 Technology Place Drive, MS 2203A, Westford, MA, 01886, USA
meissner@linux.vnet.ibm.com