[PATCH] D95672: [LV] Vectorize backward load after store accesses

Hu Jiangping via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 29 01:31:19 PST 2021


hujp created this revision.
hujp added reviewers: hsaito, echristo.
Herald added subscribers: pengfei, hiraditya, kristof.beyls.
hujp requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This patch enable the vectorization of backward load after store
accesses.  For example:

  for (int i = 0; i++; i < n) {
    a[i] = c[i] * 10;
    b[i] = a[i + 1] + 1;
  }

The MemoryDepChecker does analysis without reordering accesses,
while this patch appends checking on the unsafe dependences with
reordering accesses.  Reordering accesses may be complex, so
first, this patch is for only load after store pattern.

Sometimes the other passes(e.g. GVN) may optimize the memory
accesses, and will make the instructions can not be vectorized.
And LoopVectorizePass will break before MemoryDepChecker works,
so this patch will not work either.

Tested on AArch64 and x86_64 Linux.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D95672

Files:
  llvm/include/llvm/Analysis/LoopAccessAnalysis.h
  llvm/include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h
  llvm/lib/Analysis/LoopAccessAnalysis.cpp
  llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
  llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
  llvm/test/Transforms/LoopVectorize/memdep.ll
  llvm/test/Transforms/LoopVectorize/pr47929-vectorize-backward-load-after-store.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95672.320072.patch
Type: text/x-patch
Size: 32718 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210129/31629f49/attachment.bin>


More information about the llvm-commits mailing list