[LV] Vectorize first-order recurrences
authorMatthew Simpson <mssimpso@codeaurora.org>
Fri, 19 Feb 2016 17:56:08 +0000 (17:56 +0000)
committerMatthew Simpson <mssimpso@codeaurora.org>
Fri, 19 Feb 2016 17:56:08 +0000 (17:56 +0000)
commit29c997c1a18ad48254622540bb2989f008da1f94
tree1d6da2cac3f38193a4d07bdb4b8d147b5b748e42
parent615a807ee835bc18478770161ab8409eea2fccdc
[LV] Vectorize first-order recurrences

This patch enables the vectorization of first-order recurrences. A first-order
recurrence is a non-reduction recurrence relation in which the value of the
recurrence in the current loop iteration equals a value defined in the previous
iteration. The load PRE of the GVN pass often creates these recurrences by
hoisting loads from within loops.

In this patch, we add a new recurrence kind for first-order phi nodes and
attempt to vectorize them if possible. Vectorization is performed by shuffling
the values for the current and previous iterations. The vectorization cost
estimate is updated to account for the added shuffle instruction.

Contributed-by: Matthew Simpson and Chad Rosier <mcrosier@codeaurora.org>
Differential Revision: http://reviews.llvm.org/D16197

llvm-svn: 261346
llvm/include/llvm/Transforms/Utils/LoopUtils.h
llvm/lib/Transforms/Utils/LoopUtils.cpp
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
llvm/test/Transforms/LoopVectorize/AArch64/first-order-recurrence.ll [new file with mode: 0644]