[llvm-commits] [llvm-gcc-4.2] r43399 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp

Duncan Sands baldrick at free.fr
Wed Nov 7 00:46:48 PST 2007


Hi Bill, the following testcase shows another problem:

struct A
{
  int a[1024];
};
void g(struct A *a, struct A *b)
{
  *a = *b;
}
struct A c;
int main(void)
{
  g(&c, &c);
}

Note that llvm-gcc generates a memcpy for the *a = *b
assignment, but it should be memmove since *a and *b
may be the same (as they are in this case).

Ciao,

Duncan.

PS: on some machines memcpy goes faster if you zero out
the destination before doing the copy.  This shows why
doing a memcpy of p to p is a bad idea!



More information about the llvm-commits mailing list