[LLVMbugs] [Bug 14567] New: Regression in LLVM 3.2 RC2 on primes benchmark

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Dec 10 14:39:02 PST 2012


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

             Bug #: 14567
           Summary: Regression in LLVM 3.2 RC2 on primes benchmark
           Product: tools
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: opt
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: alonzakai at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


On this primes benchmark,

  #include<stdio.h>
  #include<math.h>
  int main() {
    int primes = 0, curri = 2;
    while (primes < 100000) {
      int ok = true;
      for (int j = 2; j < sqrtf(curri); j++) {
        if (curri % j == 0) {
          ok = false;
          break;
        }
      }
      if (ok) {
        primes++;
      }
      curri++;
    }
    printf("lastprime: %d.\\n", curri-1);
    return 0;
  }

LLVM 3.2 RC2 is more than twice as slow as LLVM 3.1 (both using -O2).

Looking at the IR, in LLVM 3.1 the sqrt is done outside of the loop it appears
in, but not in LLVM 3.2, so 3.2 ends up doing a lot more work.

-- 
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