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

    <tr>
        <th>Summary</th>
        <td>
            [InstCombine] Missed optimization for the pattern `((a+b) & a) - ((a << 1) + b)`
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            llvm:instcombine,
            missed-optimization
      </td>
    </tr>

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

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

<pre>
    `((a + b) & a) - ((a << 1) + b)` can be folded to `(a + b) | a`.
Missed example: https://godbolt.org/z/7eT3YGY5r
Alive2 Proof: https://alive2.llvm.org/ce/z/L9PkRA
Let me know if you think it's a optimization opportunity, please.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUkk9vnDAQxT_NcBntCsZr_hw4EFZUlVIpqnpojgaGxV2DETZpN5--AlZJ2p56AunN_Kz35inn9GVkzkE-gDwHavG9nfPvZX8LatvecohDoBQoVQj0gDVQhkAxqvXngG-aKEGUGO3yPgdxiI0asWbsrGm5RW9x532EJSUqiMMjhGcIiy_aOW6Rf6lhMgyiwN77yYEogCqg6mLb2hp_tPMFqHoFqhL-Jp4_Pct5BxRGvzDh02xt9--62tSjMS_DHdHwnfOYPV2_FjvkkT0OjNfR_kTd4c0u6Hs9XlF7oMShQjt5PehX5bUd0U6Tnf0yan8DKnEyrBwfgzYXbSYyFXAexVkWU5pEadDnaSripm6SpElDeZJcc9Z1J0VRLJRqOhnonEISURSFkQxlFB8lM7cNi1Rx3Mg4g1PIg9LmzUignVs4T6LslAZG1WzcdlKidQJEoUfnGzvUemQgAiqBaNiyPny0smryHMz5unaol4uDU2i08-79Ka-92QrzeXS-vDPlGe-n-yOZzs7oe8ZJec_ziO91Anr4zzIFy2zyv9qgfb_Ux8YOQNXmdP8cptn-4MYDVVswbu3Jms3vAAAA___IhOEh">