[SLP] Stop counting cost of gather sequences with multiple uses
authorMatthew Simpson <mssimpso@codeaurora.org>
Fri, 23 Mar 2018 14:18:27 +0000 (14:18 +0000)
committerMatthew Simpson <mssimpso@codeaurora.org>
Fri, 23 Mar 2018 14:18:27 +0000 (14:18 +0000)
commit6c289a1c744802c317986989915cc328d25c210d
tree925d62a708db48084aa7f09f1233baaca01c3e93
parenta92bcbb2c8c5506d5af50a0d0c946144e212ebbb
[SLP] Stop counting cost of gather sequences with multiple uses

When building the SLP tree, we look for reuse among the vectorized tree
entries. However, each gather sequence is represented by a unique tree entry,
even though the sequence may be identical to another one. This means, for
example, that a gather sequence with two uses will be counted twice when
computing the cost of the tree. We should only count the cost of the definition
of a gather sequence rather than its uses. During code generation, the
redundant gather sequences are emitted, but we optimize them away with CSE. So
it looks like this problem just affects the cost model.

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

llvm-svn: 328316
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
llvm/test/Transforms/SLPVectorizer/AArch64/gather-cost.ll
llvm/test/Transforms/SLPVectorizer/X86/blending-shuffle.ll