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

    <tr>
        <th>Summary</th>
        <td>
            [InstCombine] miscompilation
        </td>
    </tr>

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

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

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

<pre>
    Alive2 report: https://alive2.llvm.org/ce/z/GmGpRE

```llvm
----------------------------------------
define i8 @sext_multi_uses.2(i8 %a, i1 %b, i8 %x) {
#0:
  %#1 = sext i1 %b to i8
  %#2 = mul nsw i8 %a, %#1
  %#3 = select i1 %b, i8 %#2, i8 %a
 %#4 = sub i8 %#1, %#3
  %f = mul nuw i8 %x, %#1
  %r = add i8 %f, %#4
  ret i8 %r
}
=>
define i8 @sext_multi_uses.2(i8 %a, i1 %b, i8 %x) {
#0:
  %#1 = sub nsw i8 0, %a
  %#2 = xor i8 %x, 255
 %#3 = add i8 %a, %#2
  %r = select i1 %b, i8 %#3, i8 %#1
  ret i8 %r
}
Transformation doesn't verify!

ERROR: Target is more poisonous than source

Example:
i8 %a = #x80 (128, -128)
i1 %b = #x0 (0)
i8 %x = #x00 (0)

Source:
i8 %#1 = #x00 (0)
i8 %#2 = #x00 (0)
i8 %#3 = #x80 (128, -128)
i8 %#4 = #x80 (128, -128)
i8 %f = #x00 (0)
i8 %r = #x80 (128, -128)

Target:
i8 %#1 = poison
i8 %#2 = #xff (255, -1)
i8 %#3 = #x7f (127)
i8 %r = poison
Source value: #x80 (128, -128)
Target value: poison

Summary:
  0 correct transformations
  1 incorrect transformations
  0 failed-to-prove transformations
  0 Alive2 errors
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8VU2PozgQ_TXmYiWyyxDgwKFn0hntaaXeuY8MmMQtwJE_0un99Ssbp4Ge7kmfNorApl5VvVdlq7gx8jgKUaHsG8r2CXf2pHRVq_H47MbnpFbta_XQy4sArMVZaYvYAz5ZezaIPSA4IDjwYN72_WXYKn1EcGgEgsO_CA4_hh_np0dE9og8xOeOTH8Pnz5tvvib0K3o5CiwLDBKiRFX-2twvZW_nBFmCwgKb4GMI_iOJfXLOizD1yuCEqP8W-QCjHgVYYO9HQGjGLE99oFv7tgqLIs1CgJqcD0ezQtepIxB1mgWY_aisb-T8uHmHY-ukyGdPF09Y-mchi3SdDMj9zLL_YiRDlDethHWzbD0BtPCRquOxcr3ccH2iD3-r81w9a3MJFLlH7XjqvRSOGTZqpbsnexFv-C36vyhWWy1o_cr9lPz0XRKD9xKNeJWCTMiyC2-CC27VwR0eUMen57-fvK37CfXRx_T4EFpgc9KGjUqZ7A98REb5XQjVo5XPpx78VbEqDLIQcCuBcEICgqF578J7zIi40G_IQOQzOapprP5nX16_jMRWmd_6-FHfvPxvw9hX5FRrG7NV8Ddncz6C5Fik0O3PpM_Ne9T2V3ng_sDG4L_SX7eTTzyD5ku80wNwRfeO9-WOyriaXtDLyPFeG4YuH5dXFKCG6W1vyd2dcTNDUCxHO9ACO647EW7sWpz1uoiPgfGOSS0Vtq8GydJW7G2ZCVPREVzRsmOpmWRnKqyzLOc1C2IEgoGNU_TlsCuEbucEyHSRFZAIKWUFJRAmhXbNGtakTZZSTu-o41AKREDl_3bhEukMU5UlGZpViQ9r0VvwgAFGMULDlYE4OeprrzTpnZHg1LSS2PNHMZK24fJ-9do7Hc11HIUKNvjQZpGDWfZhwIkTvfVeuIepT25etuoAcEhDNLp5Qv4LBqL4BBIGASHyPJSwX8BAAD__7qqC0g">