[llvm-bugs] [Bug 38410] New: [LV] Vectorize loops that have phi uses outside a read-only loop
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Aug 1 16:16:05 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=38410
Bug ID: 38410
Summary: [LV] Vectorize loops that have phi uses outside a
read-only loop
Product: libraries
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: Loop Optimizer
Assignee: unassignedbugs at nondot.org
Reporter: anna at azul.com
CC: llvm-bugs at lists.llvm.org
Today we fail vectorization when we have a phi that's not one of the following:
1. reduction PHI
2. induction PHI
3. first order recurrence
Basically, such phis have uses outside the loop and it's hard to identify
*which* iteration out of the vectorization-factor number of iterations is the
one we're interested in.
Loop characteristics which allow us to handle phis used outside the loop:
1. read-only loop
2. only exiting block is the latch block
3. phis used outside the loop are generated in the latch block
Given these conditions (each of which is needed for legally doing the transform
I'm describing!), we can teach the loop vectorizer to vectorize the read-only
loop and extract the last element from the <PHI1, PHI2,..PHI VF> for use
outside the loop. Note that we'll need to handle the case where the loop trip
count is not exact multiple of VF, but I believe that's details we can chalk
out: the post loop for handling extra iterations (tripCount mod VF) also needs
the phi use to be handled.
There might be a problem if we were to "over-vectorize" the loop because it's a
read-only loop, i.e. the element to be extracted from the phi-vector need not
be the last one, but the last one where the loop termination condition was
true. I think this is about generating the right set of vector instructions.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180801/4a659b91/attachment.html>
More information about the llvm-bugs
mailing list