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

    <tr>
        <th>Summary</th>
        <td>
            Wrong simplification of `or` and `icmp`s on a undefined value
        </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/gu_KaN

`(y >= (x | y)) | (x = 0) -> (x | y) = y`

```llvm
----------------------------------------
define i1 @ule_swap_or_min.2(i8 %x, i8 %y) {
#0:
  %#1 = or i8 %x, %y
 %cmp = icmp uge i8 %y, %#1
  %cmpeq = icmp eq i8 %x, 0
  %r = or i1 %cmp, %cmpeq
  ret i1 %r
}
=>
define i1 @ule_swap_or_min.2(i8 %x, i8 %y) {
#0:
  %#1 = or i8 %x, %y
  %cmp = icmp eq i8 %#1, %y
 ret i1 %cmp
}
Transformation doesn't verify!

ERROR: Target's return value is more undefined

Example:
i8 %x = #x00 (0)
i8 %y = undef

Source:
i8 %#1 = #x00 (0)       [based on undef value]
i1 %cmp = #x1 (1)
i1 %cmpeq = #x1 (1)
i1 %r = #x1 (1)

Target:
i8 %#1 = #x00 (0)
i1 %cmp = #x0 (0)
Source value: #x1 (1)
Target value: #x0 (0)

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/eJzEVcGO4ygQ_ZryBSWCIo7tgw_pTuey0q7UO9IeW8Qmblq28QDOJPv1K8Cd2Nlp7dw2ihJMvXpUPT9AWKuaXsoS0idI94kY3bs25VH3zcfYfyRHXV_LXavOEomRgzYO-I68OzdY4DvAA-BBhPC6bc_dWpsG8FBJwMPfgIdmfPtN_A50D3Q3_W4pYH4lwF-A7wlgfiGQPZMrYAFYhHGc5HtC_cwK-MsSF2JXz_RAHL6-jji1-sVPRNfypHpJFCOwoWMr3-wPMbxp89apfo2AucoJYHoBfCZxGGvJnqYCkFOvSXggPg7IWahVGzJLDpkRBZhW3RAwyg_GRt65nz85ZpRVN8jvd7z8PiemM6C5LcymvIkwMHwCjXQTwExNZPtpwPf-Ff1vyvxLmlurQZEl-N6G73PZyDcjenvSphNO6Z7UWtoeMHPkLI06XQHZ3EUvr69_vHqLfxOmkQ4ws559ND05i3aURFnSaSPJ2EdV6kX2RXRDK2-9Tq2R6HR-odQb2bt6Hr-GeCCck_2pR1M9ct2Ee6QrIH06CitrovvIFQuGdNLhps8t3U_k7F4MWxrsS4j5KjwJHpX7xbp_XtoDIEoxNcR3P1s7rrqEPLBMXGPXCXOd-ZGSShsjK0fcwiv2E8CI6v8DQslJqFbWK6dXg9Fn-TVwOk2lMdrYh7MrqUteF7wQiSxZxiktWMqK5L0sGCvkJuWbdLuh7FhVRZ5ijniiGaUpZokqkeKGUczpJs15sS6Q5qc040VebysqtrChshOqvZ3TibJ2lCVjPN_SpBVH2dpwDSD28gcJUUD0t4IpfdLqODYWNrRV1tk7jVOuleVfRvcNsaobWnVSVdxs-kRgS7WBLSWir_2D38uwpdbbVNx3UXxxyWjacnm5NMq9j8d1pTvAQzja459X-UNWDvAQKrWAh6mVc4n_BAAA___94NfW">