[llvm-bugs] [Bug 27360] New: LLVM cannot unroll loops with multiple exits

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Apr 14 16:58:01 PDT 2016


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

            Bug ID: 27360
           Summary: LLVM cannot unroll loops with multiple exits
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Keywords: googler, performance
          Severity: normal
          Priority: P
         Component: Loop Optimizer
          Assignee: unassignedbugs at nondot.org
          Reporter: danielcdh at gmail.com
                CC: davidxl at google.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

For the following test case:

bool foo(int i, int *m) {
  int w = m[i];
#pragma unroll 8
  while (w == 0) {
    if (--i < 0) return false;
    w = m[i];
  }
  return true;
}

"g++ -O2 -funroll-all-loops" can successfully unroll this loop (even without
pragma).

But LLVM rejects unrolling this loop because:

284│   // For now, only unroll loops that contain a single exit.
285├>  if (!L->getExitingBlock())
286│     return false;

This makes llvm missing many optimization opportunities.

-- 
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/20160414/7972eb28/attachment.html>


More information about the llvm-bugs mailing list