[all-commits] [llvm/llvm-project] 92c645: [LoopVectorize] Add overflow checks when tail-fold...

david-arm via All-commits all-commits at lists.llvm.org
Fri May 13 06:10:05 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 92c645b5c196fb093af699f9e47cc4c539aa174b
      https://github.com/llvm/llvm-project/commit/92c645b5c196fb093af699f9e47cc4c539aa174b
  Author: David Sherwood <david.sherwood at arm.com>
  Date:   2022-05-13 (Fri, 13 May 2022)

  Changed paths:
    M llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
    M llvm/test/Transforms/LoopVectorize/AArch64/sve-tail-folding-forced.ll
    M llvm/test/Transforms/LoopVectorize/AArch64/sve-tail-folding-unroll.ll
    M llvm/test/Transforms/LoopVectorize/AArch64/sve-tail-folding.ll

  Log Message:
  -----------
  [LoopVectorize] Add overflow checks when tail-folding with scalable vectors

In InnerLoopVectorizer::getOrCreateVectorTripCount there is an
assert that the known minimum value for the VF is a power of 2
when tail-folding is enabled. However, for scalable vectors the
value of vscale may not be a power of 2, which means we have
to worry about the possibility of overflow. I have solved this
problem by adding preheader checks that prevent us from entering
the vector body if the canonical IV would overflow, i.e.

  if ((IntMax - TripCount) < (VF * UF)) ... skip vector loop ...

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




More information about the All-commits mailing list