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: unassignedb...@nondot.org
          Reporter: daniel...@gmail.com
                CC: davi...@google.com, llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to