[LoopVectorizer] Refine loop vectorizer's register usage calculator by ignoring speci...
authorCong Hou <congh@google.com>
Sun, 13 Dec 2015 16:55:46 +0000 (16:55 +0000)
committerCong Hou <congh@google.com>
Sun, 13 Dec 2015 16:55:46 +0000 (16:55 +0000)
commitf26946fa526e28e7384899ec3fffb25809ad19d3
tree194b22f6291e0dab7473df9f1b771c368f75013d
parentc38f040496ab843113dc456f1f77ec3ba27e79e2
[LoopVectorizer] Refine loop vectorizer's register usage calculator by ignoring specific instructions.

(This is the second attempt to check in this patch: REQUIRES: asserts is added
to reg-usage.ll now.)

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@255460 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Vectorize/LoopVectorize.cpp
test/Transforms/LoopVectorize/X86/vector_max_bandwidth.ll
test/Transforms/LoopVectorize/reg-usage.ll [new file with mode: 0644]