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

    <tr>
        <th>Summary</th>
        <td>
            VectorCombine transform leading to srem by poison
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            miscompilation,
            llvm:instcombine
      </td>
    </tr>

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

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

<pre>
    https://alive2.llvm.org/ce/z/HRAkAK

this:
```llvm
define <4 x i32> @f(<4 x i32> %0, <4 x i32> %1) {
  %3 = srem <4 x i32> %1, %0
  %4 = srem <4 x i32> <i32 1, i32 1, i32 1, i32 1>, %0
  %5 = shufflevector <4 x i32> %3, <4 x i32> %4, <4 x i32> <i32 0, i32 poison, i32 6, i32 3>
  ret <4 x i32> %5
}
```
is getting vector-combined to this:
```llvm
define <4 x i32> @f(<4 x i32> %0, <4 x i32> %1) {
  %3 = shufflevector <4 x i32> %1, <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32> <i32 0, i32 poison, i32 6, i32 3>
  %4 = shufflevector <4 x i32> %0, <4 x i32> poison, <4 x i32> <i32 0, i32 poison, i32 2, i32 3>
  %5 = srem <4 x i32> %3, %4
  ret <4 x i32> %5
}
```

but that poison in lane 1 is now problematic, this gives us full UB when it hits the srem

cc @nunoplopes @hatsunespica

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzEVE2PozgQ_TXmUurI2CYJBw7ppNFKe1tp926ggNo1NsImvb2_fgVOT0bppDWjPoyEjF2uj1d-z9beU2cRC5Y9s-yU6Dn0biom7LCfkso1b0UfwuiZPDBRMlFqQ2cUG2POw8ZNHRNljUyU_zFR_vbH4Z_D74yfGD_EMfS0RkbTlsdviY2mBluyCEweFfwLJAWTL8AUb5nY3xhFxpk43rqKLGUiB7Z7jglhMUlg8gR-wuGu-zEmu_qrh_7ySFLAGvNoIl_uZMxixn5uW4NnrIObPkKRd_tRd6wRBn8vOjryzr6vtu8TuWC5YJgwfEydXXjYnW4IiUvy0GEIZDuIkJ9qN1RksYHg4JdS-flBpg-P7EeY--pRXwX0Oco7PV-z_wwK8QBF9ons5UWk6isCiWM1Bwi9DhdUQBaMtggpkAfrXmGcXGVw0IHqpeoiHOjojB5mD-1sDPz5DK89WqAAPQUPoccV9_dl6npRj52tG40b0S-rXgc_W_Qj1Tp6JU0hm1zmOsEi3aUyk7v9lid9sddKKVXnuuFNoySvEVOOosZmm6dK8oQKwYXiKs1TpZTgm-1eVblKM9S5rKq2ZYrjoMl8e-oS8n7GYp_LnCdGV2j8-moKMZCv3TCS0YEWnhaGmBDr5ZAHsj5cbtKylZ2SqVi2nqq580xxQz74a5VAwWDx16qiYwyDMGnrWzcNYFA3yw0NLjJdvV14SObJ3DzVHYV-rja1G5goVzDx9zRO7m-sAxPl2pJnoly7-j8AAP__Lq2hYg">