[LLVMbugs] [Bug 12377] New: Loop trip count not calculated.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Mar 27 13:29:17 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=12377

             Bug #: 12377
           Summary: Loop trip count not calculated.
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Loop Optimizer
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: benny.kra at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


>From GCC PR30730:

unsigned foo(unsigned int n)
{
  unsigned x = 0;;

  while (n > 10)
    {
      n -= 2;
      x++;
    }

  return x;
}

gcc turns this into the following, but clang -O3 doesn't

unsigned foo(unsigned int n) {
  if (n > 10)
    return ((n - 11)/2)+1;

  return 0;
}

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list