<html>
<head>
<base href="https://bugs.llvm.org/">
</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 - clang spend relative much time on a simple code at -O3 (affect clang-6.0 above versions)"
href="https://bugs.llvm.org/show_bug.cgi?id=50331">50331</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>clang spend relative much time on a simple code at -O3 (affect clang-6.0 above versions)
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</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>Scalar Optimizations
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>haoxintu@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Hi all.
As the title shows, clang-6.0 upwards versions spend much time (exceeded my
expectation) to compile the following simple C code. Is this a latent
performance bug existing for many years or it's just the intention of LLVM? If
it's the intention of LLVM, I apologize for the invalid report, and please
close it asap.
$cat small.c
#include <stdint.h>
int a;
void b() {
int16_t *c;
uint8_t d;
int16_t e = 1;
int64_t f;
for (;; c++)
for (d = 30; d <= 63; d++)
for (f = -19; f <= 87; f++)
*c += e ^= a;
}
I tested the following versions on my machine:
$time clang-trunk -w -O3 small.c
real 0m15.075s
user 0m14.764s
sys 0m0.310s
$time clang-12 -w -O3 small.c
real 0m20.437s
user 0m20.080s
sys 0m0.289s
$time clang-11 -w -O3 small.c
real 0m25.627s
user 0m21.636s
sys 0m0.425s
$time clang-10 -w -O3 small.c
real 0m28.128s
user 0m24.602s
sys 0m0.423s
$time clang-6.0 -w -3 small.c
real 0m14.500s
user 0m14.240s
sys 0m0.243s
And reproduced in Godbolt: <a href="https://godbolt.org/z/KjfEdax7b">https://godbolt.org/z/KjfEdax7b</a>
(Output is "Killed - processing time exceeded" on clang-6.0 above versions)
Thanks,
Haoxin</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>