[LV] Build all scalar steps for non-uniform induction variables
authorMatthew Simpson <mssimpso@codeaurora.org>
Fri, 30 Sep 2016 15:13:52 +0000 (15:13 +0000)
committerMatthew Simpson <mssimpso@codeaurora.org>
Fri, 30 Sep 2016 15:13:52 +0000 (15:13 +0000)
commit7808833e28be784dfad2f66ed0bc3cdc05e30db2
tree588251b04e4fc195bab3219cdba1e190689792fb
parent7ca05307c92f2d5d7dc317f5fc676edbfad0fdcd
[LV] Build all scalar steps for non-uniform induction variables

When building the steps for scalar induction variables, we previously attempted
to determine if all the scalar users of the induction variable were uniform. If
they were, we would only emit the step corresponding to vector lane zero. This
optimization was too aggressive. We generally don't know the entire set of
induction variable users that will be scalar. We have
isScalarAfterVectorization, but this is only a conservative estimate of the
instructions that will be scalarized. Thus, an induction variable may have
scalar users that aren't already known to be scalar. To avoid emitting unused
steps, we can only check that the induction variable is uniform. This should
fix PR30542.

Reference: https://llvm.org/bugs/show_bug.cgi?id=30542
llvm-svn: 282863
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
llvm/test/Transforms/LoopVectorize/induction.ll