[llvm-commits] [patch] call libc memcpy/memset for big arrays

Chris Lattner clattner at apple.com
Fri Aug 24 18:15:55 PDT 2007


On Aug 24, 2007, at 4:44 AM, Rafael Espindola wrote:

> Currently we expand a memcpy/memset node to a call to the libc  
> implementation if
>
>   if ((Align & 3) != 0 ||
>       (I && I->getValue() < Subtarget->getMinRepStrSizeThreshold())) {
>
> Shouldn't this be a ">". The libc memcpy/memset are very fast for  
> big arrays.

Yep, that makes sense to me! Please commit.

Dale, please review the commit when you get a chance,

-Chris

> If I compile
>
> ---------------------------------------
> #include <string.h>
> void f1(long *a, long *b) {
>   memcpy(a, b, 8 * 16);
> }
>
> void f2(long *a, long *b) {
>   memcpy(a, b, 8 * 32);
> }
> ---------------------------------------
>
> with gcc 4.2 (-O2), it will call memcpy for f2 and not for f1.
>
> Cheers,
> -- 
> Rafael Avila de Espindola
>
> Google Ireland Ltd.
> Gordon House
> Barrow Street
> Dublin 4
> Ireland
>
> Registered in Dublin, Ireland
> Registration Number: 368047
> <memcpy.patch>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list