In the example below, LLVM currently does not eliminate the stores in the second loop, even though the second loop exactly overwrites the stores of the first loop. Similarly the first loop could be replaced by a memcpy and we still not remove it: https://godbolt.org/z/kGBEXS void init(int *P, unsigned N) { for (unsigned i = 0; i < N; i++) P[i] = 1; for (unsigned i = 0; i < N; i++) P[i] = 1; }
I work on a first patch to implement optimization with memory intrinsics https://reviews.llvm.org/D109280