llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
25.94k stars 10.58k forks source link

Redundant load is not removed around memcpy #90459

Open vladimirradosavljevic opened 2 weeks ago

vladimirradosavljevic commented 2 weeks ago

In the following example:

#include <string.h>

int test(int *a, int *b) {
  *a = 5;
  memcpy(b, a, 16384);
  return *b;
}

LLVM is not able to remove *b load, whereas GCC is able to do so, as it is shown here.