[PATCH] D113003: [LoopVectorize] Enable tail folding for scalable vectors

David Sherwood via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 2 04:24:14 PDT 2021


david-arm created this revision.
david-arm added reviewers: sdesmalen, kmclaughlin, CarolineConcatto, SjoerdMeijer, reames, fhahn.
Herald added subscribers: ctetreau, hiraditya, kristof.beyls.
david-arm requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This patch fixes up an issue with InnerLoopVectorizer::getOrCreateVectorTripCount
whereby we weren't correctly generating the runtime trip count
for scalable vectors when tail-folding.

It also removes some asserts in the tail-folding path for cases when
the VF is not scalable.

In this patch I have only permitted tail-folding to be enabled
explicitly for scalable vectors when the user has specified one
of the following flags:

  -prefer-predicate-over-epilogue=predicate-dont-vectorize
  -prefer-predicate-over-epilogue=predicate-else-scalar-epilogue

For now it's best not to enable tail-folding with scalable vectors for
low trip counts or when optimising for code size, since there has been
no analysis on whether this is worth it.

Various tests have been added here:

  Transforms/LoopVectorize/AArch64/sve-tail-folding.ll
  Transforms/LoopVectorize/AArch64/sve-tail-folding-forced.ll

The tests cannot be target independent because they require masked
load/store support, i.e. TTI.isLegalMaskedLoad and TTI.isLegalMaskedStore
need to return true.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D113003

Files:
  llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
  llvm/test/Transforms/LoopVectorize/AArch64/sve-tail-folding-forced.ll
  llvm/test/Transforms/LoopVectorize/AArch64/sve-tail-folding.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113003.384038.patch
Type: text/x-patch
Size: 46232 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211102/0b1e216d/attachment.bin>


More information about the llvm-commits mailing list