<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/97142>97142</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [DebugInfo][LowerConstantIntrinsics] Missing debug location update for new br instruction
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          Apochens
      </td>
    </tr>
</table>

<pre>
    [**LowerConstantIntrinsic-L89**](https://github.com/llvm/llvm-project/blob/8823448807f3b1a1362d1417e062d763734e02f5/llvm/lib/Transforms/Scalar/LowerConstantIntrinsics.cpp#L89)

The new created br instruction replacing the old br instruction `BI` has no debug location update, which should propagate the debug location of `BI` to it.

```cpp
      BasicBlock *Source = BI->getParent();
 Other->removePredecessor(Source);
      BI->eraseFromParent();
-> BranchInst::Create(Target, Source);
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUk8FunDAQhp_GXKyszBiMOXBYskVaKVUjJS9gzABuvTayTaK-fQXbNEmTHooQSMzM75nh-1WMZnKIDSlbUp4ytabZh-a4eD2ji1nvh597DI4Ejnf-GcOtdzEpl84uBeOi0Td3sr7GSXkiIOeUlkj4kUBHoJtMmtf-oP2FQGft08vrZgn-O-pEoOut7wl0UgIvCilZNfI-VzkXMORFXiETMFSCV7xABmP5RsdsdY9BuTj6cIkEugetrAoEus97jQe9LAT43nJN2Imw4_X5OCN1-Ex1QJVwoH2gxsUUVp2MdzTgYpU2bqJpRurthwQiWHsmgtFZReo8HbBfJ2q9Vnt4XQaVkMAtfZ6Nnmmc_WoHugS_qEkl3GX_qvHjq2ry1KTD24aJYNd7m2j_QverVdHo1nr9gxI4Pvg1aKSEn2h7viH8y4TpXgV0iYDcVsDb38Xf0oxhywh48U94H3BAjTH6QEBeZd7lXw_bNTGoiF3wl0-VtwzaBuX0fHYxbWTw4-2-ZgLyUYUJ07aYj2f8GTEbGj7UvFYZNnmV16IAKXg2N7LkKJQsBGdVnws9sLIWEmQtB14xKDPTAIOCCaiZ4AXwgyhg5IJXiolCSNmTguFFGXvYmDr4MGUmxhWbusoLyKzq0cYXd4RmJ7dfp0gKZk1M8bUsmWR3H522v3h2o9_sULb_AJGUJ_rVxLgh9SkrdPRhJ_I9aNkabPPfFttn2vxxHeupgV8BAAD__5FvPQQ">