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

Eric Fiselier via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 3 16:02:25 PST 2018


EricWF created this revision.
EricWF added reviewers: chandlerc, bkramer.

This patch adds support for memmove formation to LoopIdiomRecognize.cpp, which fixes llvm.org/PR25165.

The following loops now optimize to a memmove.

  void copy(int *begin, int *end, int *out) {
    for (; begin != end; ++begin, ++out)
      *out = *begin;
  }
  
  void copy2(int *dest, int *source, int size) {
    for (int i=0; i < size; ++i)
      dest[i] = source[i];
  }


https://reviews.llvm.org/D42889

Files:
  include/llvm/IR/IRBuilder.h
  lib/IR/IRBuilder.cpp
  lib/Transforms/Scalar/LoopIdiomRecognize.cpp
  test/Transforms/LoopIdiom/basic-address-space.ll
  test/Transforms/LoopIdiom/basic.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42889.132756.patch
Type: text/x-patch
Size: 19900 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180204/f16332ae/attachment.bin>


More information about the llvm-commits mailing list