[llvm-bugs] [Bug 35448] New: Loop unrolling breaks vectorization

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Nov 28 09:40:36 PST 2017


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

            Bug ID: 35448
           Summary: Loop unrolling breaks vectorization
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Loop Optimizer
          Assignee: unassignedbugs at nondot.org
          Reporter: sanjoy at playingwithpointers.com
                CC: llvm-bugs at lists.llvm.org

Perhaps this is already a known issue, but Clang/LLVM trunk does not vectorize
the inner matmult loop unless the "#pragma unroll" is enabled:

void f(int * __restrict__ a, int * __restrict__ b, int * __restrict__ r) {
  for (int m = 0; m < 64; m++) {
    int c = 0;
    // #pragma unroll
    for (int i = 0; i < 32; i++) {
      c += a[i] * b[m * 32 + i];
    }
    r[m] = c;
  }
}

It looks like the loop unroller fully unrolls the inner loop and the SLP
vectorizer is unable to vectorize as well as the Loop vectorizer would have
vectorized the not-unrolled 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/20171128/363ab906/attachment.html>


More information about the llvm-bugs mailing list