[LLVMbugs] [Bug 17830] New: Loop vectorizer does not handle loop with a trip count equal to the vector size

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Nov 5 20:55:57 PST 2013


http://llvm.org/bugs/show_bug.cgi?id=17830

            Bug ID: 17830
           Summary: Loop vectorizer does not handle loop with a trip count
                    equal to the vector size
           Product: tools
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: opt
          Assignee: unassignedbugs at nondot.org
          Reporter: fwinter at jlab.org
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 11494
  --> http://llvm.org/bugs/attachment.cgi?id=11494&action=edit
L3 has trip count 4

In a nested loop setup, where the inner loop's trip count is equal the vector
size (e.g. 4 in case of SSE), this loop gets not vectorized. In this case,
because the resulting loop would have a trip count of 1, the loop could also be
removed leaving only the loop body.

I'll attach an example which computes something similar to

for (int i = start ; i < end ; ++i )
  for (int p = 0 ; p < 3 ; ++p )
    a[i*4+p] = b[i*4+p] + c[i*4+p];

(NB, coming from C this gets vectorized. Possibly due to unrolling and the SLP
vectorized. I would like to specifically address the loop vectorizer here.)

When I call on the attached IR the following command:

opt -loop-vectorize -debug-only=loop-vectorize loop4.ll -S

Then the loop vectorizer complains:

LV: Checking a loop in "main"
LV: Found a loop: L3
LV: Found a loop with a very small trip count. This loop is not worth
vectorizing.
LV: Not vectorizing.

This is not good. I would be great if the loop vectorizer could handle this
loop.

-- 
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/20131106/bef89918/attachment.html>


More information about the llvm-bugs mailing list