]> granicus.if.org Git - llvm/commit
[SLP] Fix for PR32036: Vectorized horizontal reduction returning wrong
authorAlexey Bataev <a.bataev@hotmail.com>
Thu, 23 Feb 2017 09:40:38 +0000 (09:40 +0000)
committerAlexey Bataev <a.bataev@hotmail.com>
Thu, 23 Feb 2017 09:40:38 +0000 (09:40 +0000)
commit29965753c8a30249f3a16b82f19fa39190b47bfa
tree786ae5d287c8a10ba0120cb4c1dc7cbdfe60ea11
parentff35eecd7d89b71d167449779283b46dff244315
[SLP] Fix for PR32036: Vectorized horizontal reduction returning wrong
result

Summary:
If the same value is used several times as an extra value, SLP
vectorizer takes it into account only once instead of actual number of
using.
For example:
```
int val = 1;
for (int y = 0; y < 8; y++) {
  for (int x = 0; x < 8; x++) {
    val = val + input[y * 8 + x] + 3;
  }
}
```
We have 2 extra rguments: `1` - initial value of horizontal reduction
and `3`, which is added 8*8 times to the reduction. Before the patch we
added `1` to the reduction value and added once `3`, though it must be
added 64 times.

Reviewers: mkuper, mzolotukhin

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295949 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Vectorize/SLPVectorizer.cpp
test/Transforms/SLPVectorizer/X86/horizontal-list.ll