[llvm-bugs] [Bug 51103] New: Not able to vectorize struct members

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jul 15 02:03:59 PDT 2021


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

            Bug ID: 51103
           Summary: Not able to vectorize struct members
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Loop Optimizer
          Assignee: unassignedbugs at nondot.org
          Reporter: llvm-dev at redking.me.uk
                CC: a.bataev at hotmail.com, florian_hahn at apple.com,
                    llvm-bugs at lists.llvm.org

Reported here: https://lists.llvm.org/pipermail/llvm-dev/2021-July/151796.html

#define N 10
struct foo {
  float a[N][N];
  float b[N];
};

void compute(struct foo *p)
{
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      p->a[i][j] += 0.1f * p->b[i];
    }
  }
}

LLVM isn't able to vectorize this code. I'm not sure what the issue is here
as it seems to vectorize this code:

#define N 10
struct foo {
  float a[N];
  float b[N];
};

void compute(struct foo *p)
{
  for (int i = 0; i < N; i++) {
      p->a[i] += 0.1f * p->b[i];
  }
}

Current Codegen: https://llvm.godbolt.org/z/nah3ov9fT

-- 
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/20210715/6493627b/attachment.html>


More information about the llvm-bugs mailing list