[llvm-bugs] [Bug 28981] New: Missed forced vectorization due to llvm.mem.parallel_loop_access getting lost

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Aug 15 04:45:17 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=28981

            Bug ID: 28981
           Summary: Missed forced vectorization due to
                    llvm.mem.parallel_loop_access getting lost
           Product: tools
           Version: trunk
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: opt
          Assignee: unassignedbugs at nondot.org
          Reporter: dorit.nuzman at intel.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 16953
  --> https://llvm.org/bugs/attachment.cgi?id=16953&action=edit
Example loop with #pragma clang loop vectorize(assume_safety)

The following loop does not get vectorized because we lose some of the
information that is implied by "#pragma clang loop vectorize(assume_safety)":

void test(Complex *out, long size)
{
    long m = size / 2;
    #pragma clang loop vectorize(assume_safety)
    for (long offset = 0; offset < m; ++offset) {
      Complex t0 = out[offset];
      Complex t1 = out[offset+m];
      out[offset] = t0 + t1;
      out[offset+m] = t0 - t1;
    }
}

clang++ -S force-vect-test1.cpp -g -m64 -Ofast -funroll-loops -static
-mfpmath=sse -march=core-avx2 -Rpass-analysis=loop-vectorize
force-vect-test1.cpp:29:5: remark: loop not vectorized: cannot check memory
dependencies at runtime [-Rpass-analysis]
    for (long offset = 0; offset < m; ++offset) {
    ^
force-vect-test1.cpp:29:5: warning: loop not vectorized: failed explicitly
specified loop vectorization [-Wpass-failed]


By the time this loop reaches the vectorizer, some of the memory operations in
the loop don't have the llvm.mem.parallel_loop_access metadata, because:

1) clang does not annotate the memcpy that it creates in the loop with the
llvm.mem.parallel_loop_access metadata (this is PR28980)

2) Even if we annotate the memcpy manually, InstCombine later replaces it with
a ld/st and does not copy over the llvm.mem.parallel_loop_access metadata (this
is D23499)

3) later SROA does not preserve the llvm.mem.parallel_loop_access metadata
during its transformations (will upload a proposed patch shortly)

-- 
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/20160815/f62fbe9b/attachment.html>


More information about the llvm-bugs mailing list