<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/63644>63644</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Long compile time at -O3 on x86_64-linux_gnu (a long latent issue)
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
shao-hua-li
</td>
</tr>
</table>
<pre>
For the following code, clang at -O3 would need more than 25 seconds to compile on my machine. `opt-bisect-limit` shows that `Loop Strength Reduction` takes most of the time.
```console
% cat a.c
int a, b;
long d;
int e(int f) {
int c;
for (; c; c++)
if (f << c)
return c;
return 0;
}
void g() {
a = 0;
for (; a > -22; a--) {
d = b + d + d;
b = e(d);
}
}
int main(){}
%
% time clang-tk a.c -O2
real 0m0.061s
user 0m0.031s
sys 0m0.026s
%
% time clang-tk a.c -O3
real 0m26.647s
user 0m25.463s
sys 0m1.163s
%
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMVMturDgQ_RqzKYGMDQYWLG6np1dXijTzAZExBXhi7BY26eTvR4Z-JZrFlRC2zzlVp_yU3uvRIrakPJDymMg1TG5p_SRdOq0yNTrpXP_VntwCYUIYnDHuou0IyvVI2AsoI-0IMkD6yuHiVtODRexhdgtCmKQFVoJH5WzvIThQbj5rg-AszF8wSzVpixkQQd05pJ32qEJq9KwDERT85C4-pglR8du5M_wTFrRjmOBv7FcVtLNRGOQ7epidD-CGrdSgZ8wIPRL66_oXdP-Us94ZvKKsBCUDyEztgLYBZJxZR_hhh4yzI_T3YVQgYXVsB8IaINWVAYiYuisBBrcAYTXhhw0GRdhh-5qbAkAPUTIA4S-Ev0TJEwmwYFgX-y3rFaJ3iFTHvfPhdA9jdPxelwTCj08B3yqL5F-QMrYN0vRHLEC_RXdA2CH24_8pE0SGH7c16WPxD-pe16NzX8JZarsXGr3uPCsfGxP3cD9haXiPWwTpK3vOs6A0hDZ0phkVud_B1eNyA_kN9F_-hjHh_9CL_68XE5koqp9mrMwKwX-45Vl-xx5ut4OY9C3vG97IBNtc1DUvmqIpk6kt-rwTVIhecGwabBRjVVMNeSfzoaSKJbpllHFaUU7zss7LjFZiqPIaRZHLquE1KSjOUpvMmI85c8uYaO9XbAUXRZEY2aHx26VnzOIFNpIwFt-ApY0xabeOnhTUaB_8I0vQwWD7220vwH6Tt4W7PgDOwmct3kSRGm3Xz7fRrvGQSdiukJEBbbiZNcm6mHYK4ewJ_0XYibDTqMO0dplyM2GnaHpt0vPi_kUVCDtt0Z6w0zaV_wIAAP__5blSfQ">