<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/100327>100327</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Missing `DW_AT_abstract_origin` debug info in outlined function generated by partial inlining
</td>
</tr>
<tr>
<th>Labels</th>
<td>
debuginfo
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
tianqingw
</td>
</tr>
</table>
<pre>
Reproducer: [Godbolt](https://godbolt.org/z/6jMGxKrex)
In the reproducer, both GCC and Clang do partial inlining for `foo()`, but they generate different debug info for the outlined function:
* GCC
```
0x000003e1: DW_TAG_subprogram
DW_AT_abstract_origin (0x0000025a "foo")
DW_AT_low_pc (0x0000000000000000)
DW_AT_high_pc (0x0000000000000166)
DW_AT_frame_base (DW_OP_call_frame_cfa)
DW_AT_call_all_calls (true)
```
* Clang
```
0x0000025f: DW_TAG_subprogram
DW_AT_low_pc (0x0000000000000040)
DW_AT_high_pc (0x000000000000019e)
DW_AT_frame_base (DW_OP_reg7 RSP)
DW_AT_linkage_name ("foo.1.extracted")
DW_AT_name ("foo.1.extracted")
```
I'm not sure whether we should take GCC's emission as standard. But a nice property of it is that one can easily infer the name of the source function from `DW_AT_abstract_origin`, while with the Clang debug info, the only way doing this is decoding the mangled name.
The same issue may also be applicable for other optimizations using CodeExtractor (e.g. HotColdSplitting).
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVd2SmzgTfRr5piuUkMHgCy489uf5UlupTSVTNZeUkBpQIiRWEvE4T78l8NoTZ2c3S_kHo9Ot06fVx9x71RnEiuQPJD-s-BR666qguPlDme60aqw8V59wdFZOAh1Z74DkD49WNlYHkh8IK_sQRk_WO8KOhB27ZSmxriPs-J2w4-bLh8eX3xy-ELYl9EDobvl8byD0CO6WnO2hsaGHx_0euJGw19x0IC2M3AXFNSijlVGmg9Y6IBvaWktYGfNu6Bw9hZjzDB0adDwgSNW26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