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

Rafael Espindola espindola at google.com
Fri Aug 24 04:44:24 PDT 2007


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.

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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: memcpy.patch
Type: text/x-patch
Size: 1494 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20070824/da7d9d51/attachment.bin>


More information about the llvm-commits mailing list