aaron.ballman added a comment.

In https://reviews.llvm.org/D22725#493942, @JDevlieghere wrote:

> In https://reviews.llvm.org/D22725#493940, @aaron.ballman wrote:
>
> > > Using std::copy opens up the possibility of type-aware optimizations 
> > > which are not possible with memcpy.
> >
> >
> > To my knowledge, those type-aware optimizations are for transforming copies 
> > involving trivially-copyable types into calls to memcpy(). What other 
> > optimizations does this check enable?
>
>
> I might be mistaken, but I understood that a call to std::copy (whether or 
> not specialized for certain types) might get inlined, while a call to memcpy 
> is typically not.


The optimizer can be quite smart about memcpy(). For instance: 
https://godbolt.org/g/INfHWE

If we know of specific cases where std::memcpy() is used, but std::copy() will 
provide better performance metrics, that would be really interesting to know.


Repository:
  rL LLVM

https://reviews.llvm.org/D22725



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to