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

    <tr>
        <th>Summary</th>
        <td>
            [InstCombine] `disjoint` should be dropped in `foldSelectICmpEq`
        </td>
    </tr>

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

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

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

<pre>
    Alive2: https://alive2.llvm.org/ce/z/am7W57
```

----------------------------------------
define i32 @src(i32 noundef %x, i32 noundef %y, i32 %c) {
entry:
  %xor = xor i32 noundef %y, noundef %x
  %cmp = icmp eq i32 %xor, %c
  %and = and i32 noundef %x, noundef %y
  %or = or disjoint i32 noundef %y, noundef %x
 %not = xor i32 %c, 4294967295
  %and1 = and i32 %or, %not
  %cond = select i1 %cmp, i32 %and, i32 %and1
  ret i32 %cond
}
=>
define i32 @src(i32 noundef %x, i32 noundef %y, i32 %c) {
entry:
  %or = or disjoint i32 noundef %y, noundef %x
  %not = xor i32 %c, 4294967295
  %and1 = and i32 %or, %not
  ret i32 %and1
}
Transformation doesn't verify!

ERROR: Target is more poisonous than source

Example:
i32 noundef %x = #x0000000f (15)
i32 noundef %y = #x0000000f (15)
i32 %c = #x00000000 (0)

Source:
i32 %xor = #x00000000 (0)
i1 %cmp = #x1 (1)
i32 %and = #x0000000f (15)
i32 %or = poison
i32 %not = #xffffffff (4294967295, -1)
i32 %and1 = poison
i32 %cond = #x0000000f (15)

Target:
i32 %or = poison
i32 %not = #xffffffff (4294967295, -1)
i32 %and1 = poison
Source value: #x0000000f (15)
Target value: poison

Summary:
  0 correct transformations
  1 incorrect transformations
  0 failed-to-prove transformations
  0 Alive2 errors
```

</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJy0VVGPmzgQ_jXDi5WVGUNIHnigSSP16aRtpXt2sElcgU1tk0v6608Ghw3b3Wt10qLVEsbzeb75xuPhzqmTlrKE_BMgCl9ff97-AUTI9wkf_NnYMhqToxG3smrVRSKwipy97x2wCvAAeOCj_altL92TsSfAQy0BDz_DUlf8nRdAK1jT-EcroNXqDx-glZCN0pIohgQy6mwNuAkf2gxayIYA5lfAHXllu91tgHkNuCVQfAJaSe3tLTCnFRmhxhJgexLeb-2wiBIxddePGBV-yB_3KFdjA2KMFz25FqNneL_FeREtYiIhY4lQ7rtR2v8RMcBcG7_IZcp8RzLcZtt1gdv8gVe6IDbGjey18XOmJibgZCtrT1Qa838Ql2ux_EpHtJV-JmG0CGUv9uE_2wP7_OF1_Z8qfoCMD0JEcSYhvlmuXWNsx70ymggjnQYsPLlIq5obYDq1yufn57-eQ9N94_YU9nKkM1aS3ihntBkc8WeuiTODrWWEXHnXt3KS47WmI2FAdqXTE6ybNAfc_up8-61zEOe1Ew1OdPIBWn2dmM1kHrruHdB8zGandIy7CHvvrd-wi5EmtV7M9yIHdBOfgH4oMu7I6peQ6Zu7zX3yHplQ77F8Cxk-ltukO7nwdgjqv8stnqvZb94g7DF0HX9pLEpqY224Cfzi9LpxNSVK_9c6JQ1XrRQrb1a9NRf5jtc0Z4i01lj3anYkomRiy7Y8kWVasHyLLKcsOZdZLVPGOBWUUpZK0VCWb4paMlY3Gc-KRJVIMacpZek63yA-1ewoxXGdScnSlNcbyKjsuGrnQZYo5wZZppjmG5a0_ChbF4dlp1xtul61I_EwM3EHiAEJrFLa-dp0R6VlHKe2DEur43BykNFWOe9ewnjl23EKf9HO7yIu3xNY0_vlBWtK3NkMrSBHSYQ1fS8FUTr4NKYVX8f7-cuu6z__gDVNBtuWyyF9Uv48HJ9q0wEeRp7TK1Tiu6w94GFM1wEeYsaXEv8NAAD__1TySk0">