[llvm-bugs] [Bug 52128] New: Failure to vectorize accumulation when result is stored in memory

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Oct 10 11:05:13 PDT 2021


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

            Bug ID: 52128
           Summary: Failure to vectorize accumulation when result is
                    stored in memory
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: gabravier at gmail.com
                CC: llvm-bugs at lists.llvm.org

void mac(const int *b, int *sum)
{
  int dotp = 0;
  for (int i = 0; i < 32; i++)
    dotp += b[i];

  *sum = dotp;
}

This is not vectorized, but could be. This is done by GCC, but not by LLVM.

PS: Oddly, this can easily be changed to vectorize, but only by making it so
`dotp` is returned instead of stored into memory.

-- 
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/20211010/90c2c76d/attachment.html>


More information about the llvm-bugs mailing list