[SLP] Take user instructions cost into consideration in insertelement vectorization.
authorAlexey Bataev <a.bataev@hotmail.com>
Mon, 12 Feb 2018 14:54:48 +0000 (14:54 +0000)
committerAlexey Bataev <a.bataev@hotmail.com>
Mon, 12 Feb 2018 14:54:48 +0000 (14:54 +0000)
commitca2396e6732dfab06cf96a475520b9266852277a
treef34adcf3ab160c87ae32ee3d76bb7413046c7215
parent426991730495a6666a7ff8d085d40e3b8626ca3b
[SLP] Take user instructions cost into consideration in insertelement vectorization.

Summary:
For better vectorization result we should take into consideration the
cost of the user insertelement instructions when we try to
vectorize sequences that build the whole vector. I.e. if we have the
following scalar code:
```
<Scalar code>
insertelement <ScalarCode>, ...
```
we should consider the cost of the last `insertelement ` instructions as
the cost of the scalar code.

Reviewers: RKSimon, spatel, hfinkel, mkuper

Subscribers: javed.absar, llvm-commits

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

llvm-svn: 324893
llvm/include/llvm/Transforms/Vectorize/SLPVectorizer.h
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
llvm/test/Transforms/SLPVectorizer/AArch64/gather-root.ll
llvm/test/Transforms/SLPVectorizer/X86/insert-element-build-vector.ll
llvm/test/Transforms/SLPVectorizer/X86/jumbled-load-multiuse.ll
llvm/test/Transforms/SLPVectorizer/X86/sign-extend.ll
llvm/test/Transforms/SLPVectorizer/X86/value-bug.ll