[SLP] Fixed cost model for horizontal reduction.
authorAlexey Bataev <a.bataev@hotmail.com>
Thu, 1 Dec 2016 18:42:42 +0000 (18:42 +0000)
committerAlexey Bataev <a.bataev@hotmail.com>
Thu, 1 Dec 2016 18:42:42 +0000 (18:42 +0000)
commit62af7252f17caba27def8f8947c2b7425823bea8
treec83d5ba1bbb0b3cfd5c7273fe8e9adce818b2c45
parent358faec6ab268e4614494668706281f174e1ebb7
[SLP] Fixed cost model for horizontal reduction.

Currently when cost of scalar operations is evaluated the vector type is
used for scalar operations. Patch fixes this issue and fixes evaluation
of the vector operations cost.
Several test showed that vector cost model is too optimistic. It
allowed vectorization of 8 or less add/fadd operations, though scalar
code is faster. Actually, only for 16 or more operations vector code
provides better performance.

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

llvm-svn: 288398
llvm/include/llvm/CodeGen/BasicTTIImpl.h
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
llvm/test/Analysis/CostModel/X86/reduction.ll
llvm/test/Transforms/SLPVectorizer/X86/reduction_unrolled.ll