[PATCH] D50474: [LV] Vectorize header phis that feed from if-convertable latch phis
Anna Thomas via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 8 13:53:03 PDT 2018
anna created this revision.
anna added reviewers: Ayal, mkuper, mssimpso.
This patch teaches loop vectorizer to vectorize phi nodes that have the
following characteristics:
1. header phis that are not identified as induction/reduction/first order
recurrences.
2. feeds in from a phi in the latch block and that phi can be if-converted
3. unused outside the loop.
Condition #3 will be avoided in a follow on change.
This is to teach the vectorizer about general recurrences and cross iteration
dependencies.
The key point here is that if the header phi feeds from an if-convertable phi,
then the header phi can be vectorized. The 'resume' value extracted for this
header phi in the scalar post loop is the last element of the vectorized phi in
the latch block.
Please see added test cases. A current TODO item is we do not want to vectorize
'dead' loops, i.e. a read only loop whose values computed in the loop have no
outside users.
Please note: I will add more test cases, this is a proof of concept patch just
to make sure I've not missed some obvious legality constraint.
Repository:
rL LLVM
https://reviews.llvm.org/D50474
Files:
include/llvm/Transforms/Utils/LoopUtils.h
include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h
lib/Transforms/Utils/LoopUtils.cpp
lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
lib/Transforms/Vectorize/LoopVectorize.cpp
test/Transforms/LoopVectorize/vectorize-general-recurrence.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50474.159785.patch
Type: text/x-patch
Size: 21139 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180808/1eb7c4fb/attachment-0001.bin>
More information about the llvm-commits
mailing list