[PATCH] D126295: [LoopVectorize] Fix assertion failure in fixReduction when tail-folding

David Sherwood via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 24 06:17:15 PDT 2022


david-arm created this revision.
david-arm added reviewers: sdesmalen, igor.kirillov, kmclaughlin, RosieSumpter.
Herald added subscribers: rogfer01, bollu, hiraditya.
Herald added a project: All.
david-arm requested review of this revision.
Herald added subscribers: llvm-commits, alextsao1999, vkmr.
Herald added a project: LLVM.

When compiling the attached new test in scalable-reductions-tf.ll we
were hitting this assertion in fixReduction:

  Assertion `isa<PHINode>(U) && "Reduction exit must feed Phi's or select"

The loop contains a reduction and an intermediate store of the reduction
value. When vectorising with tail-folding the contains of 'U' in the
assertion above happened to be a scatter_store. It turns out that we
were still creating a widen recipe for the invariant store, despite
knowing that we can actually sink it. The simplest fix is to change
buildVPlanWithVPRecipes so that we look for invariant stores before
attempting to widen it.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D126295

Files:
  llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
  llvm/test/Transforms/LoopVectorize/AArch64/scalable-reductions-tf.ll
  llvm/test/Transforms/LoopVectorize/AArch64/scalable-reductions.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126295.431657.patch
Type: text/x-patch
Size: 5866 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220524/f894b551/attachment.bin>


More information about the llvm-commits mailing list