<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/139970>139970</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Long and memory-wasting debug symbols generation
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
speshuric
</td>
</tr>
</table>
<pre>
### Steps to reproduce
1. Save attached [main.cpp.txt](https://github.com/user-attachments/files/20214729/main.cpp.txt) as cpp file
2. Compile it with debug information and O2/O3 optimizations. I use: `clang++ main.cpp -g -O2`
3. Uncomment lines one by one and compile again
### Expected
Compile time is almost instantly.
### Actually
Compile time grows twice with every uncommented line. Memory usage exceeds 20GB with uncommented line with `f24`
| Last uncommented line | Compile time on my PC, seconds |
|--------|--------|
| f16 | 0.945 |
| f17 | 1.627 |
| f18 | 3.170 |
| f19 | 6.121 |
| f20 | 12.355 |
| f21 | 25.471 |
| f22 | 51.952 |
| f23 | 1:46.11 |
### Environment
```text
$clang++ --version
clang version 19.1.7
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
```
```text
$uname -a
Linux 6.14.6-arch1-1 #1 SMP PREEMPT_DYNAMIC Fri, 09 May 2025 17:36:18 +0000 x86_64 GNU/Linux
```
Despite I use clang installed as package from archlinux repos, the same issue observed on [godbolt](https://godbolt.org/) site with various clang versions and targets.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJx8VE2P2zgM_TXKhbAh01_xIQdnpikKdNrBtj3sqZAtxtGuLRmSnEn21y8kZ9pmtthAgOJHkXykqCecU4Mm2rFyz8rHjVj8ydidm8mdFqv6TWfkdccwXxd88TQ78AYszdbIpSfG2yyFL-JMILwX_YkksHI_CaXTfp5Tf_GsfGS4PXk_O5a3DA8MD4Pyp6VLezMxPCyObLJ6T6S9Y3g4qpHCjhyzosaG4eEuJDYgHPTzDOEk4y2m8GCmWY0E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