<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/97084>97084</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[DebugInfo][LoopFlatten] Missing debug location update for new branch instruction
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Apochens
</td>
</tr>
</table>
<pre>
[**LoopFlatten-L787**](https://github.com/llvm/llvm-project/blob/76c8e1d8575fbeebdc0e18e0792e8f0a623834b3/llvm/lib/Transforms/Scalar/LoopFlatten.cpp#L787)
The new branch instruction created in `InnerExitingBlock` replacing the original terminator has no debug location.
```cpp
InnerExitingBlock->getTerminator()->eraseFromParent();
->BranchInst::Create(InnerExitBlock, InnerExitingBlock);
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUkt1q3DAQhZ9mfCOyyCPLPxe-2M3GEEih0LyAZI9ttVrJSHLavn2xTdMtoRcFY8GMdOYM51MxmskRtSAvIK-ZWtPsQ3tefD-Ti5n2w8-9h2fA84v3S2dVSuQeXqq6Oqogr4D1nNISQZwBO8BuMmle9an3N8DO2rffx8MS_FfqE2CnrdeAXVX2NeVDLSs5aiI99JzymnjVINUjVyWKWhRa3OmY7d1rUC6OPtwiYPelV1YFwO7O4alfFkBx-GyAX4Gfj__rTMzRd6aDcv3MjIsprH0y3rE-kEo0MOMYlPzZOQpPP0wybrpY33-DkrNAi1W9cRNLMzEfzGScsixRuBmnkg9sVpE5zwbS68Ss79Umfbp3ACU_vs3jXmEfZj2AeJoovb7rAtaAzVamoCJ1wd8-q0AuHQ0Ql0Nqu3HZV3t2MW2RiPPjvhdg_T7m2AcfPw6-13o3mg2tGBrRqIzavMob2YhcFtnc5kWlhC5QV7rUoxY4CORKy0FKlQ8SM9Mix4KXWOdlIWVxkrkeeS90UQpJTV5DwemmjD1t-Z58mDIT40ptU_G6yKzSZOPBIG6p7U1A3HAN7Q6VXqcIBbcmpvhHJZlkd7CvWxDPbvQbqfJyxwjIK_tkYtzS_Dsuti6DSsRGH_7BSrYG2_439bv7Ddlju7cWfwUAAP__2A4c8w">