<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/92719>92719</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang] performance hog at -O2 with clang-14, and 19-init
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
bi6c
</td>
</tr>
</table>
<pre>
```c
#include "csmith.h"
int a, b, c = 5;
void d() {
e:
if (safe_add_func_int64_t_s_s(c, c))
goto e;
}
int main() {
for (; a >= 0; a--) {
b = -18;
for (; b != -10; b = safe_add_func_int16_t_s_s(b, 8)) {
d();
}
}
}
```
OS: Ubuntu 22.04.3 LTS.
There is a performance difference when we compile it with (llvmorg-13.0.0) vs. (llvmorg-14.0.0 and llvmorg-19-init) at optimization level "-O2".
```console
$ ../compiler-builds/llvmorg-13.0.0_build/bin/clang -fsanitize=undefined -g -lgcc_s --rtlib=compiler-rt -I/home/csmith/include/csmith-2.3.0 -O2 testcase.c -o exec
$ timeout 2s ./exec
real 0m0.001s
user 0m0.001s
sys 0m0.000s
$ ../compiler-builds/llvmorg-14.0.0_build/bin/clang -fsanitize=undefined -g -lgcc_s --rtlib=compiler-rt -I/home/csmith/include/csmith-2.3.0 -O2 testcase.c -o exec
$ timeout 2s ./exec
real 0m2.000s
user 0m2.000s
sys 0m0.000s
$ ../compiler-builds/llvmorg-19-init_build/bin/clang -fsanitize=undefined -g -lgcc_s --rtlib=compiler-rt -I/home/csmith/include/csmith-2.3.0 -O2 testcase.c -o exec
$ timeout 2s ./exec
real 0m2.000s
user 0m2.000s
sys 0m0.000s
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzkVU2v7CYP_jXMxgIRk2QyiyzueecdqVKls7i36xEhTkJFwiiQc3rvr6_IZL5uN5W6a6WIgG2wn8fG6BBsPxHVrHhjxXGnlzj4uW5saXaNb7_XrJTXzzB5ZPILQ2Un45aWgCGaMNo4iIEhbup1tFMEzfB_0KTBAFNHKJh6u2o_vG2hZVgxPADbb1JiatsNYDtgWAXd0Vm37blbJnO2UyzzczyHc2BYmfVghof0bbsAeh890N0R2x8f8YzaTj_7hM7PyRNTb6CBqf-nQOW64vzVEgCaFQfPqruDJH06ogGG2dVGbmt1hL_AyMo7jJWf6grj1RncGHpxdkf0mD0mt0w9Z-L9K1Nf4LdmmeICiELmQsGv376Kq_rbQDOBDaDhQnPn51FPhqC1XUczpennQBN8Ehg_XqwjsBE-bRwSZOc-Rj_3PFNCCpkQfATxosiTAvTUwl104HayMRnrCP4S7Wh_6Gj9BI4-yKWi4u_IEMUzjEcV-il4R7dazEEIhqctuJk3i3VtYHh6je28yhmemlQDJ-P01APvgp5stD-IqeMytdTZiVrgPXDXG3MOwPkcnW2YOt4dzBH4LwxPgx8pnbTWP8PTdifuIo5CCQn8HSFSiEYHEga4B_qDzCP6aEfySwQMkHA8KddxJu1S2uUohZRZuEqXQPNPovA9wMNQhhfu_gZL-b-DJXwCv7H0LPqnLF1r979K0-0K7tpatQd10Duqs31WZlWpVLEb6q7CrjVSSqKmMaSLvOzafYMaK9yXjdzZGiXmskApSyxUIbrMyMxkWZU1B5NVmuWSRm2dSJQLP_c7G8JC9QH32WHndEMu3F6quU5GvFn6wHLpbIjhsS3a6NY3bc0OK44v7W3wfeo-ic-1l61GPMtTM07Nakv0bpldPcR4CelpwhPDU2_jsDTC-HGri-3HL7P_nUxMyUsRp7JZg_4zAAD__zewIgY">