[PATCH] D136544: [SLP] For vectorizing chains in basic block, decide order of PHI nodes based on their result use.

krishna chaitanya sankisa via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 22 21:19:39 PDT 2022


skc7 created this revision.
skc7 added reviewers: arsenm, bcahoon.
Herald added subscribers: kosarev, vporpo, kerbowa, 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 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 decides the order of phinodes in the tree entry, based on the order of use of the results of phi nodes in the BB. This will make sure the resulting mask of shuffle vectors are same.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D136544

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136544.469955.patch
Type: text/x-patch
Size: 22167 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221023/0ac36836/attachment.bin>


More information about the llvm-commits mailing list