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

    <tr>
        <th>Summary</th>
        <td>
            [DebugInfo][SimplifyCFGPass] Missing the debug location update for the new br 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>
    [**SimplifyCFGPass-L146**](https://github.com/llvm/llvm-project/blob/7ee421d29612ae919edfe7250b87e3c738d66a26/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp#L146)

The new br instruction, which replaces the old terminator `Term` of the same block, should inherent the debug location of `Term`.

```cpp
 auto *Term = BB->getTerminator();
    ...
 Term->eraseFromParent();
->  BranchInst::Create(CanonicalBB, BB);
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUU9FunDAQ_BrzYgWZBQw88HDclSpSK0XK_YAxC7g1NrJNovx9ZS5N0rQvlZBB7Mx4VjsrvFezQWxJ2ZHykog9LNa1p83KBY1PBju-HDU4ETg9qnXTano5918fhPd337KC3yqkvBColxA2T_ITgZ5AP6uw7EMq7Uqg1_rp9-tuc_YHykCgH7QdCPQVYgHZCA3PQGCTNThOWEHJhrrCXFZ5PXIugH_QUZF3dcL4ybrVE-gfpdDCxY8_XaZy2wjkN68NYRfCTrfzuiA1-EwHR5Xxwe0yKGsInOnzouRCHW5aSPQ0LEitHmlAtyojgnWUcHZFtxLOqJ0OgBcr0kFb-TMq-MXueqTKLOjQhAMx4rDPVFsp4j2R966SfjRGOLs90frxh4o9WErgFOGU5BfadXck_zJjuL6ZIlDHDvPulUMpTdNXYRphkYFOeOydXR9ENPaJExGUdk4YudwbH-Iw89PZoQhIoD4LY42SQnddbDKe79w318nY5mOTNyLBNquypmFZlhfJ0tZZBmUxDnLCouYICEWV17zitRgbhDJRLTAoWMWA8awuixQQG97wSbAyYxMfScFwFUqnMQepdXOivN-xbaq8rhMtBtT-lleIkz2KBCBG27VH-IZ99qRgWvng31WCCvpYgkuc0b2ZbEx02X3KEikv9LvyXpn5XxPdt1EEpJN1R_XvbCW70-1_b8nRRYz4rcunFn4FAAD__5A-JJU">