[PATCH] D136467: [SLP] Correct shuffle cost to reuse vectorized values in depending nodes

Dinar Temirbulatov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 21 10:02:44 PDT 2022


dtemirbulatov created this revision.
dtemirbulatov added reviewers: ABataev, RKSimon, dmgreen, peterwaller-arm, paulwalker-arm, c-rhodes, awarzynski, spatel, MattDevereau.
Herald added subscribers: vporpo, hiraditya.
Herald added a project: All.
dtemirbulatov requested review of this revision.
Herald added a subscriber: pcwang-thead.
Herald added a project: LLVM.

While estimating a node cost of the tree which has dependency on another node we might too optimistic estimate code of shuffle operation by assuming that it is depending on a single tree node with TargetTransformInfo::SK_Select.

For example such node dependence ended up with this snippet:

  %9 = fsub fast <2 x float> %8, %3
  %10 = fadd fast <2 x float> %8, %3
  %11 = shufflevector <2 x float> %9, <2 x float> %10, <2 x i32> <i32 0, i32 3>

Which ended up in suboptimal result in the end.


https://reviews.llvm.org/D136467

Files:
  llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
  llvm/test/Transforms/SLPVectorizer/AArch64/depend-node-shuffle.ll
  llvm/test/Transforms/SLPVectorizer/AArch64/slp-fma-loss.ll
  llvm/test/Transforms/SLPVectorizer/AArch64/transpose-inseltpoison.ll
  llvm/test/Transforms/SLPVectorizer/AArch64/transpose.ll
  llvm/test/Transforms/SLPVectorizer/X86/alternate-fp-inseltpoison.ll
  llvm/test/Transforms/SLPVectorizer/X86/alternate-fp.ll
  llvm/test/Transforms/SLPVectorizer/X86/alternate-int-inseltpoison.ll
  llvm/test/Transforms/SLPVectorizer/X86/alternate-int.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136467.469564.patch
Type: text/x-patch
Size: 44484 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221021/48e93519/attachment.bin>


More information about the llvm-commits mailing list