[LV] Untangle the concepts of uniform and scalar
authorMatthew Simpson <mssimpso@codeaurora.org>
Tue, 2 Aug 2016 14:29:41 +0000 (14:29 +0000)
committerMatthew Simpson <mssimpso@codeaurora.org>
Tue, 2 Aug 2016 14:29:41 +0000 (14:29 +0000)
commit58f562887b10edc60f43fde6fdefab592e5c8aac
tree03e916bc2751228716d2041ddd280e9809374108
parent9b0ee9c522b53c5a9859fd2cbd7e056739dcbcd2
[LV] Untangle the concepts of uniform and scalar

This patch refactors the logic in collectLoopUniforms and
collectValuesToIgnore, untangling the concepts of "uniform" and "scalar". It
adds isScalarAfterVectorization along side isUniformAfterVectorization to
distinguish the two. Known scalar values include those that are uniform,
getelementptr instructions that won't be vectorized, and induction variables
and induction variable update instructions whose users are all known to be
scalar.

This patch includes the following functional changes:

- In collectLoopUniforms, we mark uniform the pointer operands of interleaved
  accesses. Although non-consecutive, these pointers are treated like
  consecutive pointers during vectorization.

- In collectValuesToIgnore, we insert a value into VecValuesToIgnore if it
  isScalarAfterVectorization rather than isUniformAfterVectorization. This
  differs from the previous functionaly in that we now add getelementptr
  instructions that will not be vectorized into VecValuesToIgnore.

This patch also removes the ValuesNotWidened set used for induction variable
scalarization since, after the above changes, it is now equivalent to
isScalarAfterVectorization.

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

llvm-svn: 277460
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
llvm/test/Transforms/LoopVectorize/induction.ll