[all-commits] [llvm/llvm-project] c22eb9: [NFC][LoopIdiom] Add reproducer of wrong memmove t...

yurai007 via All-commits all-commits at lists.llvm.org
Wed Aug 25 08:30:34 PDT 2021


  Branch: refs/heads/release/13.x
  Home:   https://github.com/llvm/llvm-project
  Commit: c22eb9a4a5ddfb6985dd2bc218be4e0ca5e9e512
      https://github.com/llvm/llvm-project/commit/c22eb9a4a5ddfb6985dd2bc218be4e0ca5e9e512
  Author: Dawid Jurczak <dawid_jurek at vp.pl>
  Date:   2021-08-25 (Wed, 25 Aug 2021)

  Changed paths:
    M llvm/test/Transforms/LoopIdiom/basic.ll

  Log Message:
  -----------
  [NFC][LoopIdiom] Add reproducer of wrong memmove transformation

That's precommit test for D107964.

Differential Revision: https://reviews.llvm.org/D108537


  Commit: 4e692c97a8c17a6eaf60f81327edff357086aa74
      https://github.com/llvm/llvm-project/commit/4e692c97a8c17a6eaf60f81327edff357086aa74
  Author: Dawid Jurczak <dawid_jurek at vp.pl>
  Date:   2021-08-25 (Wed, 25 Aug 2021)

  Changed paths:
    M llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
    M llvm/test/Transforms/LoopIdiom/basic.ll

  Log Message:
  -----------
  [LoopIdiom] Don't transform loop into memmove when load from body has more than one use

This change fixes issue found by Markus: https://reviews.llvm.org/rG11338e998df1
Before this patch following code was transformed to memmove:

for (int i = 15; i >= 1; i--) {
  p[i] = p[i-1];
  sum += p[i-1];
}

However load from p[i-1] is used not only by store to p[i] but also by sum computation.
Therefore we cannot emit memmove in loop header.

Differential Revision: https://reviews.llvm.org/D107964

(cherry picked from commit bdcf04246c401aec9bdddf32fabc99fa4834a477)


Compare: https://github.com/llvm/llvm-project/compare/d069343fa526...4e692c97a8c1


More information about the All-commits mailing list