[LoopVectorizer] Refine loop vectorizer's register usage calculator by ignoring speci...
authorCong Hou <congh@google.com>
Tue, 15 Dec 2015 22:45:09 +0000 (22:45 +0000)
committerCong Hou <congh@google.com>
Tue, 15 Dec 2015 22:45:09 +0000 (22:45 +0000)
commite956465289bde1ad371a92b73710b48ed791e56f
tree02cb6c9186d25f56d6d1969f6da7a7fd7d7b38b2
parentaa98140781941712fa8ff3d3b70ab800c32c8510
[LoopVectorizer] Refine loop vectorizer's register usage calculator by ignoring specific instructions.

(This is the third attempt to check in this patch, and the first two are r255454
and r255460. The once failed test file reg-usage.ll is now moved to
test/Transform/LoopVectorize/X86 directory with target datalayout and target
triple indicated.)

LoopVectorizationCostModel::calculateRegisterUsage() is used to estimate the
register usage for specific VFs. However, it takes into account many
instructions that won't be vectorized, such as induction variables,
GetElementPtr instruction, etc.. This makes the loop vectorizer too conservative
when choosing VF. In this patch, the induction variables that won't be
vectorized plus GetElementPtr instruction will be added to ValuesToIgnore set
so that their register usage won't be considered any more.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255691 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Vectorize/LoopVectorize.cpp
test/Transforms/LoopVectorize/X86/reg-usage.ll [new file with mode: 0644]
test/Transforms/LoopVectorize/X86/vector_max_bandwidth.ll