[PATCH] D42889: [LoopIdiomRecognize] Add support for memmove. Fixes PR25165

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 5 14:18:34 PST 2018


efriedma added a comment.

This transform isn't legal.  Consider:

  #include <assert.h>
  void not_memmove(int *x, int *y, int n) {
    for (int i = 0; i < n; ++i)
      x[i] = y[i];
  }
  int main() {
    int x[] = { 1, 2, 3, 4, 5, 6 };
    not_memmove(&x[1], &x[0], 5);
    for (int i = 0; i < 6; ++i)
      assert(x[i] == 1);
  }


https://reviews.llvm.org/D42889





More information about the llvm-commits mailing list