[all-commits] [llvm/llvm-project] 8daffd: Fix SLP score for out of order contiguous loads

alban-bridonneau-arm via All-commits all-commits at lists.llvm.org
Tue Apr 19 03:59:25 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8daffd1dfb55c706d8661c65ed05380bcc68ce4b
  Author: Alban Bridonneau <alban.bridonneau at arm.com>
  Date:   2022-04-19 (Tue, 19 Apr 2022)

  Changed paths:
    A llvm/test/Transforms/SLPVectorizer/AArch64/tsc-s116.ll

  Log Message:
  Fix SLP score for out of order contiguous loads

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

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.

Reviewed By: ABataev

Differential Revision: https://reviews.llvm.org/D123516

More information about the All-commits mailing list