<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/57664>57664</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang-15 compile time regression: 30 seconds -> over 40 minutes
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
vogelsgesang
</td>
</tr>
</table>
<pre>
During upgrading an internal code base to clang-15, I noticed to our "VM" (essentially a computed-goto based interpreter loop) is taking over 40 minutes to compile in clang-15 (I do not know the exact time, I ran out of patience). With clang-14 it used to take between 30 and 60 seconds.
While I cannot share the original source code, https://godbolt.org/z/4chMrr99f contains a simplified repro.
Looking at the `perf record` results for the first 5 minutes (I ran out of patience to record a longer time slice), all time is spent in a single function:
```
99.84% clang libLLVM-15.so [.] llvm::GenericCycleInfoCompute<llvm::GenericSSAContext<llvm::MachineFunction> >::run
```
In particular in a single loop consisting of only 4 instructions
```
0.00 │ 440:┌─→mov %rax,%r15
88.51 │ │ mov (%rax),%rax
0.03 │ ├──test %rax,%rax
8.72 │ └──jne 440
```
Not sure what this loop does on a logical level, but it seems like it's following a link list until it finds the end of that list marked by a nullptr.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx9VF1z2yoQ_TXyy040CH3EPOgh12k6nknuS2faZyytJBoMGkBO0l9_F2QnTZpejYwXAcvZs3v2YPuX9nZxyoywzKOTfbSkAWUCOiM1dLZHOEiPECx0WprxqqgzvoM9GBtUh31csIuDjPPvDzSQsUXv0QQltX4BST6O8xKwvxot7Y3O-vWC2SGNoK2dMy5AeQjyMSKwJ_pcMTgqQwd9upucKI108BVGvGkPvY1I4NHYJwgTAj7LLkBQR1xhOgrHLgHsALMMCk1HCyKHHypMF1cVqACLX4MhDBQyhidEAyUjOnpoGHjsrOl9nrHbjN2s448pQtpDJ03E4CfpMIGwTo0q8ueJmg4TjRHOFMLss_Im43f0jr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