OSDN Git Service

[LV] Fix the vector code generation for first order recurrence
authorAnna Thomas <anna@azul.com>
Thu, 13 Apr 2017 18:59:25 +0000 (18:59 +0000)
committerAnna Thomas <anna@azul.com>
Thu, 13 Apr 2017 18:59:25 +0000 (18:59 +0000)
commit0bd00d7d97b7327f5e34149fad571a3926448767
tree1474b501306e7bf46adae30322307fe9ad6af85b
parent7784ce736d88efe4aa94970ec76e70361ec22d97
[LV] Fix the vector code generation for first order recurrence

Summary:
In first order recurrences where phi's are used outside the loop,
we should generate an additional vector.extract of the second last element from
the vectorized phi update.
This is because we require the phi itself (which is the value at the second last
iteration of the vector loop) and not the phi's update within the loop.
Also fix the code gen when we just unroll, but don't vectorize.
Fixes PR32396.

Reviewers: mssimpso, mkuper, anemet

Subscribers: llvm-commits, mzolotukhin

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300238 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Utils/LoopUtils.cpp
lib/Transforms/Vectorize/LoopVectorize.cpp
test/Transforms/LoopVectorize/AArch64/loop-vectorization-factors.ll
test/Transforms/LoopVectorize/first-order-recurrence.ll