<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/138684>138684</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[DebugInfo][LICM] Debug value info loss caused by removing dead instructions without salvaging
</td>
</tr>
<tr>
<th>Labels</th>
<td>
debuginfo
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Apochens
</td>
</tr>
</table>
<pre>
1. Removing the dead instruction without salvaging the debug value info in `hoistAdd`:
https://github.com/llvm/llvm-project/blob/393c783a10052b14d2b76b3ee930b3d83e7f1a16/llvm/lib/Transforms/Scalar/LICM.cpp#L2597
**Code example:** https://godbolt.org/z/TbjdP5Y1d
2. Removing the dead instruction without salvaging the debug value info in `hoistSub`:
https://github.com/llvm/llvm-project/blob/393c783a10052b14d2b76b3ee930b3d83e7f1a16/llvm/lib/Transforms/Scalar/LICM.cpp#L2675
**Code example:** https://godbolt.org/z/h3veE8fj9
3. Removing the dead instruction without salvaging the debug value info in `hoistBOAssociation`:
https://github.com/llvm/llvm-project/blob/393c783a10052b14d2b76b3ee930b3d83e7f1a16/llvm/lib/Transforms/Scalar/LICM.cpp#L2882-L2883
**Code example:** https://godbolt.org/z/9nE7Tob6E
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzMlM1q3DwUhq9G3ogM0pEl2QsvJpkYAvn4SpNNl_qzraCxBkueNr36IqchZboqySJwsDH4_D3vy1Ep-XF2rkP8GvFDpdY8xaXbn6KZ3JwqHe1zR3f4qzvGs59HnCeHrVMW-znlZTXZxxl_93mKa8ZJhbMa337T64jPKqwO-3mI2M8YCTJFn_LeWiQIYntESkw5n1L5gh5BP_o8rXpn4hFBH8L59XV1WuKTMxlBr0PUCHrWMiMbpighHDStLWgpNHOuZUQz2zAnB6qo-KOOL3mPi5rTEJdjQtA_GBXUgqC_v7v5b2dOJwTsHngrX2ZDUOImWofdD3U8BbcNWgJfzB2tjiHv4jIi6H-WPvrJfuHfqH0pBR8P8mHVnxykkPz9ICd2drfN8NS-lGIfD_L6_31K0XhV8j850qaBq_Jk7wfbzrfyMWpxW9mO2Za1qnIdlbXgTFAC1dSB1VRALVUjLWvJoNtaCt3yZqjVMBhR-Q4IcMKJoMA5gR1wY01tSC2oqqWRqCbuqHzYlT1L78qntLqOskY0dRWUdiFtFwhgk6hogwDKQVq6ja5ex4RqEnzK6a1M9jlsp-tQsu5KFj8gfl1gIX7Ah0u9Q0wJG7UmZ7F-xsurhy79k_42ULUuoftnL2yLFiF_73ru4FcAAAD__-PUuQ8">