[PATCH] D105199: [LoopVectorize] Fix scalable vector crash in VPReplicateRecipe::execute

David Sherwood via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 30 08:34:48 PDT 2021


david-arm created this revision.
david-arm added reviewers: sdesmalen, CarolineConcatto, peterwaller-arm, kmclaughlin.
Herald added subscribers: rogfer01, hiraditya, kristof.beyls.
david-arm requested review of this revision.
Herald added subscribers: llvm-commits, vkmr.
Herald added a project: LLVM.

When trying to vectorise certain loops using scalable vectors we try to
use the replicate recipe even for non-uniform cases. The recipe does
not handle scalable vectors correctly because it tries to scalarise
the vector instruction by generating a scalar instance for each lane
and packing them into a vector. We don't know the number of lanes at
runtime so this is not an option.

I've decided to create a new scalable replicate recipe instead called
VPScalableReplicate, which also calls a new overloaded version of
scalarizeInstruction that generates a whole vector part in one go,
instead of generating N scalar instances for N lanes. The new version
of scalarizeInstruction is based on the original version, and currently
only supports certain cases, such as GEP instructions, or instructions
with loop-invariant operands.

Tests have been added here:

  Transforms/LoopVectorize/AArch64/sve-vpreplicate.ll


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D105199

Files:
  llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
  llvm/lib/Transforms/Vectorize/VPlan.cpp
  llvm/lib/Transforms/Vectorize/VPlan.h
  llvm/lib/Transforms/Vectorize/VPlanValue.h
  llvm/test/Transforms/LoopVectorize/AArch64/sve-vpreplicate.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105199.355560.patch
Type: text/x-patch
Size: 17941 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210630/5d7ea175/attachment.bin>


More information about the llvm-commits mailing list