<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - very slow compilation at -O2 and -O3 with -g enabled on x86_64-pc-linux-gnu"
href="http://llvm.org/bugs/show_bug.cgi?id=17325">17325</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>very slow compilation at -O2 and -O3 with -g enabled on x86_64-pc-linux-gnu
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>LLVM Codegen
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>su@cs.ucdavis.edu
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>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;
}</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>