Add a new reduction pattern match
authorRenato Golin <renato.golin@linaro.org>
Fri, 30 Nov 2018 13:40:10 +0000 (13:40 +0000)
committerRenato Golin <renato.golin@linaro.org>
Fri, 30 Nov 2018 13:40:10 +0000 (13:40 +0000)
commit135e72e1b9647f7740f9c619d45b3e4392a8acee
tree0dbf076a1acba7a1148fd1688a10381b8a5cd636
parent26403def69f72c7938889c1902d62121095b93d7
Add a new reduction pattern match

Adding a new reduction pattern match for vectorizing code similar
to TSVC s3111:

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

This patch adds support for fadd, fsub and fmull, as well as multiple
branches and different (but compatible) instructions (ex. add+sub) in
different branches.

The difference from the previous patch(https://reviews.llvm.org/D49168)
is as follows:
 - Added check of fast-math property of fp-instruction to the
   previous patch
 - Fix/add some pattern for if-reduction.ll

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

Patch by Takahiro Miyoshi <takahiro.miyoshi@linaro.org>
     and Masakazu Ueno <masakazu.ueno@linaro.org>

llvm-svn: 347989
llvm/include/llvm/Analysis/IVDescriptors.h
llvm/lib/Analysis/IVDescriptors.cpp
llvm/test/Transforms/LoopVectorize/if-reduction.ll [new file with mode: 0644]