[LLVMbugs] [Bug 16196] New: nested loops 500x slower to compile at -O2 than -Os

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Jun 2 13:54:23 PDT 2013


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

            Bug ID: 16196
           Summary: nested loops 500x slower to compile at -O2 than -Os
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: dhazeghi at yahoo.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

The following code takes much longer to compile at -O2 than at -Os, using
current clang-trunk on x86_64-linux.  This is a regression from clang 3.0.

$ clang-trunk -v
clang version 3.4 (trunk 183083)
Target: x86_64-pc-linux-gnu
Thread model: posix
$ time clang-trunk -Os long.c 

real    0m0.047s
user    0m0.025s
sys    0m0.017s
$ time clang-3.0 -O2 long.c

real    0m0.060s
user    0m0.036s
sys    0m0.016s
$ time clang-trunk -O2 long.c 

real    0m25.436s
user    0m25.242s
sys    0m0.135s

-----------
int *a;
int b, d, e, f;
void fn1 ()
{
    int c;
    a = &c;
}

void fn2 ()
{
    for (; b; ++b)
    {
        for (d = 0; d < 9; ++d)
        {
            for (e = 0; e >= -24; --e)
            {
                for (f = 0; f <= 31; f = f + 1)
                    fn1 ();
            }
        }
    }
}

void fn3 ()
{
    fn2 ();
}

int main ()
{
    fn3 ();
    return 0;
}

-- 
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/20130602/6d2d7b96/attachment.html>


More information about the llvm-bugs mailing list