This is the mail archive of the
mailing list for the GCC project.
Re: [Gcl-devel] Re: sibling call optimization
Jim Wilson <email@example.com> writes:
> Camm Maguire wrote:
> > Greetings, and thanks! Any idea why the example file wasn't optimized
> > with -O3 (but with -O2), and/or on some method whereby I can instruct
> > gcc to inform me when the optimization was made?
> The example file can't be compiled, so it is imposible to say. All I
> can do is state the obvious, -O3 enables -finline-functions, so
> function inlining must be interferring with sibling call optimizations
Thanks! -fno-inline-functions restored the sibling call. Is this
'inline overrides sibling' behavior intentional? Is there any way
that I can write the call itself in a way to prevent inlining in that
instance? I.e. to let the callee be inlined elsewhere, but to prevent
it where I want the sibcall?
> There is apparently no way to tell when the optimization is made.
> Many optimization passes emit a message to the dump file when they
> succeed in doing something, but sibcall.c does not. At the place
> where it sets successful_replacement, we could emit a message to the
> dump file. Or alternatively, we could increment a counter, and print
> the total count after the pass is finished. You could submit a
> bugzilla bug report requesting this feature, or you could try writing
> it yourself.
Thanks! I might take a look at submitting a patch if/when I get a
I noticed there was a long thread about defining some attribute and/or
warning regarding sibling call optimization a few years ago. I don't
know what the final conclusion was if any. Is the idea of a -Wsibling
coupled with some extension to specify a sibling call in the code off
the table? Its fine if it is, its just that if it isn't, time spent
toward a patch would better be directed in this direction rather than
towards a dump entry, as it is easier for the user to use.
> Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com
Camm Maguire firstname.lastname@example.org
"The earth is but one country, and mankind its citizens." -- Baha'u'llah