[llvm-bugs] [Bug 28980] New: memcpy without llvm.mem.parallel_loop_access metadata in loop annotated with #pragma clang loop vectorize(assume_safety)

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


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

            Bug ID: 28980
           Summary: memcpy without llvm.mem.parallel_loop_access metadata
                    in loop annotated with #pragma clang loop
                    vectorize(assume_safety)
           Product: clang
           Version: trunk
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: dorit.nuzman at intel.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 16949
  --> https://llvm.org/bugs/attachment.cgi?id=16949&action=edit
Example .cpp and output of clang for that .cpp where memcpy is missing the
mem_par metadata

Clang doesn't attach a llvm.mem.parallel_loop_access metadata for memcpy
instructions in a loop that is annotated with 
#pragma clang loop vectorize(assume_safety):

Example1:

    #pragma clang loop vectorize(assume_safety)
    for (long i = 0; i < size; i+=2) {
        memcpy(&(out[i]), &(out[i+size]), 2);
    }


Example2: Here the struct copies result in a memcpy: 

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;
    }
}

.c and .ll created by clang attached.

Generated the .ll like so:
clang++ -S -emit-llvm -mllvm -disable-llvm-optzns [-g -m64 -static -mfpmath=sse
-march=core-avx2]

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


More information about the llvm-bugs mailing list