[llvm-bugs] [Bug 50686] New: [LV] expandBounds generates wrong runtime checks

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jun 11 12:55:44 PDT 2021


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

            Bug ID: 50686
           Summary: [LV] expandBounds generates wrong runtime checks
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Loop Optimizer
          Assignee: unassignedbugs at nondot.org
          Reporter: chenmindong1 at huawei.com
                CC: llvm-bugs at lists.llvm.org

void m(int *p, int *p2, int q) {
  {
    int *a = p2;
    for (; k < q; k++)
      a[k] = 2;
  }
  int *a = p;
  int i, j, r;
  i = 0;
  for (; i < 63; i++) {
    r = j = 0;
    for (; j < 63; j++)
      r -= p2[j];
    a[i] = r;
  }
}

Compiled with `clang -O3`, the inner loop will be fully unrolled, and LV
determines it's possible to vectorize the outer loop with runtime checks.
However, the runtime checks generated are incorrect in that the range generated
for the `p2` group is [p2+62, p2+63) rather than [p2, p2+63).

-- 
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/20210611/47a38c48/attachment.html>


More information about the llvm-bugs mailing list