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

Takahiro Miyoshi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 11 00:30:40 PDT 2018


takahiro.miyoshi created this revision.
takahiro.miyoshi added reviewers: mkuper, karthikthecool, TylerNowicki, mcrosier, rengolin, t.p.northover.
Herald added a subscriber: llvm-commits.

This patch aims to add a new reduction pattern match for vectorizing a following code which is similar to TSVC s3111.

  for (int i = 0; i < N; i++)
    if (a[i] > b)
      sum += a[i];

In old implementation, this was not recognized as the reduction pattern though input IRs was already if-converted. This pattern is a little similar to RK_FloatAdd pattern, but strictly speaking this is not RK_FloatAdd pattern because this is not a little different from sum of floats. And, this pattern is also a little similar to MRK_FloatMax, but this is different from that except for the case of b == 0.

So, in new implementation, I add a new recurrence descriptor in order to express the difference of the above because original recurrence descriptors can't express the above pattern.


Repository:
  rL LLVM

https://reviews.llvm.org/D49168

Files:
  include/llvm/Transforms/Utils/LoopUtils.h
  lib/Transforms/Utils/LoopUtils.cpp
  test/Transforms/LoopVectorize/if-reduction.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49168.154758.patch
Type: text/x-patch
Size: 23278 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180711/1f25931e/attachment.bin>


More information about the llvm-commits mailing list