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

    <tr>
        <th>Summary</th>
        <td>
            [optimization] Missing delete redundant select as UB
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

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

<pre>
    test: https://alive2.llvm.org/ce/z/ynHjfo
```
define i16 @src(i16 %n, i16 %d) {
  %1 = icmp eq i16 %d, 0
  %2 = urem i16 %n, %d
  %3 = select i1 %1, i16 -1, i16 %2
  ret i16 %3
}

define i16 @tgt(i16 %n, i16 %d) {
  %1 = urem i16 %n, %d
  ret i16 %1
}
```

this is similar to [issue #64240](https://github.com/llvm/llvm-project/issues/64240), but here is a `[u|s]rem`
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycU8FunDAQ_ZrhMsrKDBjDgUM2CPXSYz_A4GHXkYGtbVIlX1-twzabqqrUSgjs4fnNe_azDsGeFuYW5BGIXiYzTUAEssv0Fs-rb1MpG1bz2kYOEYpHPMd4CVA8AvVAvXb2heng3Mt8WP0JqB8ZqH8D6l-XL8_TCqID8QiV2J80NTzZhdHmFUIpgh-B6jQhuQA94T42QA2COr4vwmspRyg6tON8Qf5-h3tCcYeihNo8z3hPm6AfqCKhAjseI9o80d-6P-R3Oui2yHO81YrdmOr2wR-MxVP8R2N_lXzXPf-9--f9fX_Hsw1oAwY7W6c9xhVBHm0IGyNQUZVUCpAdUP35TE82nrfhMK4zUH892f3zcPHrM48RqE8kAah_J6HmqnXYIp7Z87WnxqsYedxAPQWQnecZKpGZtjBN0eiM27xqGpmXqlTZuZ205FoNRVOTGfKKSyEmmpRppKG6nurMtiSoyHPRCEWyVIe6Go0q61zWhZnGsoBS8Kyt-xXFLGlsVa5qypwe2IU95wv_wPRzz7pvk7thOwUohbMhhg-WaKNLF2S9RDvbNx3tuoDs8KsNwS4nNOw4Mno222L0Em-B0gG_HbPNu_b_dzeJ_xkAAP__EoQFNQ">