This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ 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: small improvement for fill and fill_n


On Thu, Jun 17, 2004 at 08:54:44PM +0200, Paolo Carlini wrote:
> Hi Dan,
> 
> >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.
> 
> 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... .-(

Worse, I don't know if the extra copy is always allowed.  Anyway it's 
easy to imagine a type for which it is would be too expensive to make 
extra copies.  What we need is a way to assert explicitly that &value 
doesn't alias anything else.  Failing that, we need a way to tell if
copying is cheap and the value can be held in a register, so we can
overload on that condition.  I think there's some work on that last
for C++0x.

Nathan Myers
ncm-nospam@cantrip.org


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