This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [lto] make builtins go
On Dec 11, 2007 5:11 PM, Mark Mitchell <mark@codesourcery.com> wrote:
>
> Paolo Bonzini wrote:
> >
> >> 1. If "f" calls "sin", and "f" is compiled with -fno-builtin-sin, and
> >> "g" calls "f", and "g" is compiled with -fbuiltin-sin, should we perform
> >> builtin optimizations?
> >>
> >> 2. If "f" calls "sin" and was compiled without optimization (e.g., "-g")
> >> but, now, at LTO-time, is compiled with "-O2", should we perform
> >> builtin optimizations?
> >>
> >> I think that for (1), it makes sense not to optimize, but for (2) it
> >> makes more sense to optimize. But, I also think your suggestion is
> >> reasonable, and it does have the advantage of seeming simplest to reason
> >> about.
> >
> > I don't think my suggestion prevents optimizing (2). :-) In the (2)
> > case __builtin_sin will be serialized out (because -O0 does not imply
> > -fno-builtin), read in by LTO, and optimize.
>
> That makes sense. I didn't know that we transform sin to
> "__builtin_sin" even at "-O0".
We do not generally convert calls to sin() to calls to __builtin_sin(), but
if the middle-end introduces new calls to sin it generally uses the
builtin variant. We would need to start doing so instead, to make Paolos
suggestion work - which I think would be a sensible thing to do to address
this problem.
Richard.