[PATCH] D95245: [SVE] Add support for scalable vectorization of loops with int/fast FP reductions

Kerry McLaughlin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 22 09:28:04 PST 2021


kmclaughlin created this revision.
kmclaughlin added reviewers: sdesmalen, david-arm, greened, fhahn, frasercrmck.
Herald added subscribers: NickHung, bmahjour, psnobl, hiraditya, tschuett.
Herald added a reviewer: efriedma.
kmclaughlin requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This patch enables scalable vectorization of loops with integer/fast reductions, e.g:

  unsigned sum = 0;
  for (int i = 0; i < n; ++i) {
    sum += a[i];
  }

A new TTI interface, isLegalToVectorizeReduction, has been added to prevent
reductions which are not supported for scalable types from vectorizing.
If the reduction is not supported for the given UserVF, an invalid
InstructionCost is returned by LoopVectorizationPlanner::plan and we
bail out of vectorization in this case.

Also fixes a TypeSize warning in SelectionDAG::ComputeNumSignBits


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D95245

Files:
  llvm/include/llvm/Analysis/TargetTransformInfo.h
  llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
  llvm/lib/Analysis/TargetTransformInfo.cpp
  llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
  llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
  llvm/lib/Target/AArch64/AArch64TargetTransformInfo.h
  llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h
  llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
  llvm/test/Transforms/LoopVectorize/scalable_reductions.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95245.318549.patch
Type: text/x-patch
Size: 30037 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210122/99e8977a/attachment-0001.bin>


More information about the llvm-commits mailing list