[llvm-commits] [llvm] r120974 - in /llvm/trunk: include/llvm/Analysis/AliasAnalysis.h lib/Transforms/Scalar/DeadStoreElimination.cpp test/Transforms/DeadStoreElimination/simple.ll

Dale Johannesen dalej at apple.com
Mon Dec 6 11:38:42 PST 2010


On Dec 6, 2010, at 11:30 AMPST, Chris Lattner wrote:
> On Dec 6, 2010, at 9:36 AM, Duncan Sands wrote:
> 
>>>  // memcpy is not defined if the source and destination pointers are exactly
>>>  // equal, but other compilers do this optimization, and almost every memcpy
>>>  // implementation handles this case safely.  If there is a libc that does not
>>>  // safely handle this, we can add a target hook.
>>> 
>>> Note that the example from the PR doesn't explicitly call memcpy.
>> 
>> I've been told that on some platforms zeroing the target memory before doing the
>> copy speeds it up due to cache effects.  It looks like clang's implementation
>> of struct copy will not work on such targets.
> 
> GCC also uses memcpy.  If we find one of these theoretical platforms, clang can always generate memmove on it.

We might consider doing that anyway, to pre-emptively avoid the problem.   Memmove will not be faster, but the performance difference is zero or negligible in many environments.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20101206/659b20ad/attachment.html>


More information about the llvm-commits mailing list