[PATCH] D49168: [LV] Add a new reduction pattern match

Guozhi Wei via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 26 15:00:41 PDT 2018


Carrot added a comment.

This patch doesn't correctly handle isFast(). By default isRecurrenceInstr() should check I->isFast(), but for this pattern I is Select,  isFast() doesn't apply to it, it should be checked against FAdd/FMul inside isConditionalRdxPattern().

It caused our several internal applications failed. Following is a simple reproduction.

static double bar(double* v) {

  double t = 0.0;
  for (int i=0; i<10000; i++) {
    double s = v[i];
    if (s > 0) {
      t += s;
    }
  }
  return t;

}

double foo(double* v)
{

  return bar(v);

}

clang++ -msse4.2 -c -O2 t9.cc -save-temps

In the generated code, the loop is wrongly vectorized.


Repository:
  rL LLVM

https://reviews.llvm.org/D49168





More information about the llvm-commits mailing list