[PATCH] D123516: Fix SLP score for out of order contiguous loads

Alban Bridonneau via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 11 08:02:56 PDT 2022


alban.bridonneau created this revision.
Herald added a subscriber: hiraditya.
Herald added a project: All.
alban.bridonneau requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

SLP uses the distance between pointers to optimize
the getShallowScore. However the current code misses
the case where we are trying to vectorize for VF=4, and the distance
between pointers is 2. In that case the returned score
reflects the case of contiguous loads, when it's not actually
contiguous.

The attached unit tests have 5 loads, where the program order
is not the same as the offset order in the GEPs. So, the choice
of which 4 loads to bundle together matters. If we pick the
first 4, then we can vectorize with VF=4. If we pick the
last 4, then we can only vectorize with VF=2.

This patch makes a more conservative choice, to consider
all distances>1 to not be a case of contiguous load, and
give those cases a lower score.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D123516

Files:
  llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
  llvm/test/Transforms/SLPVectorizer/AArch64/tsc-s116.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123516.421933.patch
Type: text/x-patch
Size: 7362 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220411/38fa6cf0/attachment.bin>


More information about the llvm-commits mailing list