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

    <tr>
        <th>Summary</th>
        <td>
            [InstCombine] Missing fold for (a | ~b) ? 0 : a
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

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

    <tr>
      <th>Reporter</th>
      <td>
          k-arrows
      </td>
    </tr>
</table>

<pre>
    https://alive2.llvm.org/ce/z/Cpdcgr
```llvm
define i32 @src(i32 %0, i32 %1) {
%2:
  %3 = xor i32 %1, 4294967295
  %4 = or i32 %3, %0
  %5 = icmp eq i32 %4, 0
  %6 = select i1 %5, i32 %0, i32 0
  ret i32 %6
}
=>
define i32 @tgt(i32 %0, i32 %1) {
%2:
 ret i32 0
}
Transformation seems to be correct!
```

Original source code:
https://godbolt.org/z/9szsEa733
```c
int foo(int a, int b)
{
    return (a | ~b) ? 0 : a;
}

int bar(int a, int b)
{
    return 0;
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUk8GOmzAQhp9muIw2MmMD4cBhkyxSD1UvfQFjDHELOLXNtt1Dn73CCUkarSqtFCVM_I3_mZ8Z6b3pJ60ryHaQHRI5h6N11fcn6Zz96ZPGtr-rYwgnD_wZqAaq5WBeNW2G4XXcWNcD1UoD1W9A9f7Uqt4BOwB7hpydPwt4_qvVnZk0Gk4IgnmngLYxoIwB7fHynAKVCMXucg9ltGjHAJdzjsAP-Mu6u4Q9CipFmRdUZneoiOiN5AsZ5W5MFhmjxhPqHysoFvCeyiPl9aBVQJPGxLuar_Vfc5wO62F-6aQ4XB74AfjLe56EPnzck1WJPch8dXLynXWjDMZO6LUePQaLjUZlndMqAKUPL-sSxu8vzvRmkgN6Ozu1JLX6qvrvTPS2bewQLvOwjELp3_yLLDh_EFDn2EwBO2uXZqeAMnY6BWyAyrWL3epk9HJ2EwJtJUKxxz9NtIPXyBD4M0rgu0ePrzKNdB-TYe_ctpaftBVvS17KRFdpvk3LUuTbLDlW24wJTV3adCJvKe8KJdNOFaItckUspcRUxIgzsQRCiGyTS9WUHaeGE7VlLkEwPUozXDcrMd7PusqJcp4MstGDX9fUVQv01My9B8EG44O_pQUThrjQnyYf9nZszKQhO-Bn472Zeuzs0GJn3X_8TGY3PKx9b8JxbjbKjkB13Onzz9PJ2W9xlupYrweqY8l_AwAA__8YAylY">