[PATCH] D136757: [SLP] Extend reordering data of tree entry to support PHI nodes

krishna chaitanya sankisa via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 26 04:59:08 PDT 2022


skc7 created this revision.
skc7 added reviewers: ABataev, bcahoon, arsenm.
Herald added subscribers: kosarev, vporpo, kerbowa, mgrang, hiraditya, jvesely.
Herald added a project: All.
skc7 requested review of this revision.
Herald added subscribers: llvm-commits, pcwang-thead, wdng.
Herald added a project: LLVM.

SLPVectorize pass uses the order of vectorizable phi nodes in the basic block to form a tree entry and decides the mask of the resulting shuffle vector.
If tree entry has insertelement instruction sequence, they will be also converted to shufflevector with mask based on insertelement instruction order in BB.

In the BB, if the result of vectorizable phi nodes is used by insertelement instructions, the resulting masks of shuffle vectors after vectorizing these two tree entries can mismatch. This happens if the order of phi nodes and the order of use of results of phi nodes by extractelement/insertelement mismatch.

There will be a scope for optimizing these resulting shuffle vectors in the subsequent passes in the pipeline, if their shuffle masks match.

This change reorders the phinodes in the tree entry, based on the use of the results of phi nodes by extractelement/insertelement.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D136757

Files:
  llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
  llvm/test/Transforms/SLPVectorizer/AMDGPU/phi-result-use-order.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136757.470782.patch
Type: text/x-patch
Size: 7202 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221026/6e496da6/attachment.bin>


More information about the llvm-commits mailing list