[PATCH] D119661: [LV] Support chained phis as incoming values for first-order recurs.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 15 06:57:45 PDT 2022


fhahn updated this revision to Diff 452656.
fhahn marked an inline comment as done.
fhahn added a comment.
Herald added subscribers: vkmr, rogfer01.

In D119661#3722786 <https://reviews.llvm.org/D119661#3722786>, @Ayal wrote:

> Nice reuse of chained FOR's!
> Conceptually by looking past previous header phi's, Legal->isFirstOrderRecurrence(Phi) may be more accurately renamed Legal->isFixedOrderRecurrence(Phi) - also potentially recording its associated non-header-phi "Previous", even if the recipe implements this pattern using multiple single-element FOR splices.

Thanks for taking a look!

I think renaming would require to also update the code in IVDescriptors which does the actual recurrence identification. Please let me know if you would like me to rename it accross LVLegality and IVDescriptors.

> Wonder if some instCombine pattern may subsequently fold the multiple shuffles (and the multiple incoming vectors each holding a single element) to optimize higher-order recurrence where some phi's feed only other phi's w/o other users.

Unfortunately it doesn't look like instcombine will be able to fold those shuffles, e.g.: https://llvm.godbolt.org/z/a8YoM6ev9


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119661/new/

https://reviews.llvm.org/D119661

Files:
  llvm/lib/Analysis/IVDescriptors.cpp
  llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
  llvm/lib/Transforms/Vectorize/VPlan.h
  llvm/test/Transforms/LoopVectorize/first-order-recurrence-chains-vplan.ll
  llvm/test/Transforms/LoopVectorize/first-order-recurrence-chains.ll
  llvm/test/Transforms/LoopVectorize/first-order-recurrence.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119661.452656.patch
Type: text/x-patch
Size: 48622 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220815/850b19f1/attachment.bin>


More information about the llvm-commits mailing list