Don't punish vectorized arithmetic instruction whose type will be split to multiple...
authorCong Hou <congh@google.com>
Fri, 4 Dec 2015 00:36:58 +0000 (00:36 +0000)
committerCong Hou <congh@google.com>
Fri, 4 Dec 2015 00:36:58 +0000 (00:36 +0000)
commit21aabdad38b4f6284e44df5456b8f8f4a844c5c8
tree9609770f0c091c0bbb50b1bd1eb2a8a4bfe3c2a9
parentb7250858d96b8ce567681214273ac0e62713c661
Don't punish vectorized arithmetic instruction whose type will be split to multiple registers

Currently in LLVM's cost model, a vectorized arithmetic instruction will have
high cost if its type is split into multiple registers. However, this
punishment is too heavy and unnecessary. The overhead of the split should not
be on arithmetic instructions but instructions that implement the split. Note
that during vectorization we have calculated the register pressure, and we
only choose proper interleaving factor (and also vectorization factor) so
that we don't use more registers than the maximum number.

Here is a very simple example: if a vadd has the cost 1, and if we double VF
so that we need two registers to perform it, then its cost will become 4 with
the current implementation, which will prevent us to use larger VF.

Differential revision: http://reviews.llvm.org/D15159

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254671 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/CodeGen/BasicTTIImpl.h
test/Analysis/CostModel/X86/reduction.ll