[all-commits] [llvm/llvm-project] 8f1887: [LV] Still vectorise when tail-folding can't find ...

sjoerdmeijer via All-commits all-commits at lists.llvm.org
Thu Jan 9 01:16:55 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 8f1887456ab4ba24a62ccb19d0d04b08972a0289
      https://github.com/llvm/llvm-project/commit/8f1887456ab4ba24a62ccb19d0d04b08972a0289
  Author: Sjoerd Meijer <sjoerd.meijer at arm.com>
  Date:   2020-01-09 (Thu, 09 Jan 2020)

  Changed paths:
    M llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
    A llvm/test/Transforms/LoopVectorize/ARM/tail-folding-counting-down.ll
    A llvm/test/Transforms/LoopVectorize/tail-folding-counting-down.ll

  Log Message:
  -----------
  [LV] Still vectorise when tail-folding can't find a primary inducation variable

This addresses a vectorisation regression for tail-folded loops that are
counting down, e.g. loops as simple as this:

  void foo(char *A, char *B, char *C, uint32_t N) {
    while (N > 0) {
      *C++ = *A++ + *B++;
       N--;
    }
  }

These are loops that can be vectorised, but when tail-folding is requested, it
can't find a primary induction variable which we do need for predicating the
loop. As a result, the loop isn't vectorised at all, which it is able to do
when tail-folding is not attempted. So, this adds a check for the primary
induction variable where we decide how to lower the scalar epilogue. I.e., when
there isn't a primary induction variable, a scalar epilogue loop is allowed
(i.e. don't request tail-folding) so that vectorisation could still be
triggered.

Having this check for the primary induction variable make sense anyway, and in
addition, in a follow-up of this I will look into discovering earlier the
primary induction variable for counting down loops, so that this can also be
tail-folded.

Differential revision: https://reviews.llvm.org/D72324




More information about the All-commits mailing list