[all-commits] [llvm/llvm-project] 7ff577: [SLP] allow forming 2-way reduction patterns

RotateRight via All-commits all-commits at lists.llvm.org
Thu Nov 7 04:10:55 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 7ff57705ba196ce649d6034614b3b9df57e1f84f
      https://github.com/llvm/llvm-project/commit/7ff57705ba196ce649d6034614b3b9df57e1f84f
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2019-11-07 (Thu, 07 Nov 2019)

  Changed paths:
    M llvm/include/llvm/Transforms/Vectorize/SLPVectorizer.h
    M llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
    M llvm/test/Feature/weak_constant.ll
    M llvm/test/Transforms/SLPVectorizer/X86/reduction2.ll

  Log Message:
  -----------
  [SLP] allow forming 2-way reduction patterns

We have a vector compare reduction problem seen in PR39665 comment 2:
https://bugs.llvm.org/show_bug.cgi?id=39665#c2

Or slightly reduced here:

define i1 @cmp2(<2 x double> %a0) {
  %a = fcmp ogt <2 x double> %a0, <double 1.0, double 1.0>
  %b = extractelement <2 x i1> %a, i32 0
  %c = extractelement <2 x i1> %a, i32 1
  %d = and i1 %b, %c
  ret i1 %d
}

SLP would not attempt to turn this into a vector reduction because there is an
artificial lower limit on that transform. We can not completely remove that limit
without inducing regressions though, so this patch just hacks an extra attempt at
creating a 2-way reduction to the end of the analysis.

As shown in the test file, we are still not getting some of the motivating cases,
so follow-on patches will be needed to solve those cases.

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




More information about the All-commits mailing list