This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: small improvement for fill and fill_n
Paolo Carlini <pcarlini@suse.de> writes:
> Hi Dan,
Hi!
> > Note that the memory location pointed to by __value is accessed in
> > each loop iteration, the compiler cannot prove that __first and
> > __value do not alias. One solution would be to use a temporary like
> > so:
>
> First, thanks for the analysis: in order to seriously pursue performance
> improvements we really need this kind of work.
Well, this one was just a lucky observation while I was looking for
something unrelated.
> Coming to the point, however, I wonder whether there are hopes that the
> alias analysis will be improved in a not-to-far future... It would be
> so sad to add those temporaries: I suspect *many* would be needed in
> the whole libraries... .-(
Diego was saying before the tree-ssa merge that he wants to work on
aliasing, so you might want to ask him.
Another issue for C++ is that SRA does not work when the objects
involved use inheritance.
Now for fill and fill_n, I don't think that any improvements to
aliasing can help given the way these functions are currently
written. There is not guarantee that __value is not a reference to one
of the objects that fill[n] iterate over. So IMHO using a temporary
is unavoidable for these 2 functions if the above assumption holds.
--dan