[LLVMbugs] [Bug 17325] New: very slow compilation at -O2 and -O3 with -g enabled on x86_64-pc-linux-gnu

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Sep 22 15:29:47 PDT 2013


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

            Bug ID: 17325
           Summary: very slow compilation at -O2 and -O3 with -g enabled
                    on x86_64-pc-linux-gnu
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: su at cs.ucdavis.edu
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

The following code takes much longer to compile at -O2 and -O3 with -g enabled
than -g disabled using the current clang-trunk on x86_64-pc-linux-gnu in both
32-bit and 64-bit modes. 

It also affects clang 3.2 at both -O2 and -O3, but interestingly, it only
affects clang 3.3 at -O2 (not at -O3). 

For comparison, I also include below the relevant compilation times from GCC
and ICC. 


$ clang-trunk -v
clang version 3.4 (trunk 191164)
Target: x86_64-pc-linux-gnu
Thread model: posix
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4.6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6.3
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
$
$ 
$ time clang-trunk -O2 small.c
0.02user 0.01system 0:00.12elapsed 29%CPU (0avgtext+0avgdata 49584maxresident)k
0inputs+32outputs (0major+6129minor)pagefaults 0swaps
$ time clang-trunk -O2 -g small.c
13.29user 0.67system 0:21.18elapsed 65%CPU (0avgtext+0avgdata
2440080maxresident)k
0inputs+40outputs (0major+216883minor)pagefaults 0swaps
$ time clang-trunk -O3 small.c
0.03user 0.00system 0:00.09elapsed 34%CPU (0avgtext+0avgdata 49600maxresident)k
0inputs+32outputs (0major+6132minor)pagefaults 0swaps
$ time clang-trunk -O3 -g small.c
12.44user 0.68system 0:18.87elapsed 69%CPU (0avgtext+0avgdata
2440112maxresident)k
0inputs+40outputs (0major+216884minor)pagefaults 0swaps
$ 
$
$ time clang-3.3 -O2 small.c
0.01user 0.02system 0:00.04elapsed 74%CPU (0avgtext+0avgdata 47200maxresident)k
0inputs+32outputs (0major+5868minor)pagefaults 0swaps
$ time clang-3.3 -O2 -g small.c
12.12user 0.58system 0:18.76elapsed 67%CPU (0avgtext+0avgdata
2438048maxresident)k
0inputs+32outputs (0major+216609minor)pagefaults 0swaps
$ time clang-3.3 -O3 small.c
0.03user 0.00system 0:00.09elapsed 39%CPU (0avgtext+0avgdata 51072maxresident)k
0inputs+32outputs (0major+6114minor)pagefaults 0swaps
$ time clang-3.3 -O3 -g small.c
0.01user 0.02system 0:00.10elapsed 41%CPU (0avgtext+0avgdata 52560maxresident)k
0inputs+40outputs (0major+6217minor)pagefaults 0swaps
$ 
$
$ time clang-3.2 -O2 small.c
0.02user 0.00system 0:00.10elapsed 27%CPU (0avgtext+0avgdata 38224maxresident)k
0inputs+32outputs (0major+4876minor)pagefaults 0swaps
$ time clang-3.2 -O2 -g small.c
15.10user 0.57system 0:22.03elapsed 71%CPU (0avgtext+0avgdata
2429248maxresident)k
0inputs+32outputs (0major+215605minor)pagefaults 0swaps
$ time clang-3.2 -O3 small.c
0.01user 0.01system 0:00.06elapsed 41%CPU (0avgtext+0avgdata 38256maxresident)k
0inputs+32outputs (0major+4878minor)pagefaults 0swaps
$ time clang-3.2 -O3 -g small.c
14.63user 0.59system 0:21.96elapsed 69%CPU (0avgtext+0avgdata
2429248maxresident)k
0inputs+32outputs (0major+215548minor)pagefaults 0swaps
$ 
$ 
$ time gcc-4.8 -O2 -g small.c
0.02user 0.00system 0:00.15elapsed 23%CPU (0avgtext+0avgdata 42784maxresident)k
0inputs+40outputs (0major+6754minor)pagefaults 0swaps
$ time gcc-4.8 -O3 -g small.c
0.02user 0.01system 0:00.18elapsed 22%CPU (0avgtext+0avgdata 44032maxresident)k
0inputs+40outputs (0major+6835minor)pagefaults 0swaps
$ time gcc-trunk -O2 -g small.c
0.02user 0.01system 0:00.08elapsed 42%CPU (0avgtext+0avgdata 45888maxresident)k
0inputs+40outputs (0major+6949minor)pagefaults 0swaps
$ time gcc-trunk -O3 -g small.c
0.02user 0.01system 0:00.14elapsed 27%CPU (0avgtext+0avgdata 47152maxresident)k
0inputs+40outputs (0major+7026minor)pagefaults 0swaps
$ 
$
$ time icc -O2 -g small.c
0.23user 1.76system 0:03.42elapsed 58%CPU (0avgtext+0avgdata 86464maxresident)k
1712inputs+184outputs (21major+16595minor)pagefaults 0swaps
$ time icc -O3 -g small.c
0.25user 1.82system 0:03.13elapsed 66%CPU (0avgtext+0avgdata 86464maxresident)k
1200inputs+192outputs (7major+16594minor)pagefaults 0swaps
$ 


--------------------------------------


int a, b, c; 
unsigned int d, e;

static void foo (int p)
{
  for (a = 0; a < 30; a++)
    for (d = 0; d < 30; d++)
      for (b = 0; b < 30; b++)
    for (e = 0; e < 30; e++)
      {
        int *w = &c; 
        *w &= p; 
      }
}

static void 
bar ()
{
  foo (1);
}

int
main ()
{
  bar ();
  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/20130922/8687c341/attachment.html>


More information about the llvm-bugs mailing list