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

    <tr>
        <th>Summary</th>
        <td>
            [InstCombine] Missing optimization for div_euclid(2)
        </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>
          nikic
      </td>
    </tr>
</table>

<pre>
    From https://github.com/rust-lang/rust/issues/118392, we're missing this transform: https://alive2.llvm.org/ce/z/8-eUdb

Worth noting that this already works for other power of two constants, such as `div_euclid(4)`, so we probably already have a transform for this, but additional canonicalizations for 2 in particular get in the way.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8Uk2Po0gM_TXmYiUCV_g6cMh2hLSHPa72uDJFJdR0URVVmUTpXz-CRN3Tc5gLIGO_9-z3OCV78cZ0UP4F5SnjRaYQO2_frc6GMD66PoYZJ5FrAnUE6oH6i5VpGfY6zEB9XJLsHPvL6xuotyktJgH1RdGoloDe8G6A6mhwtilZf0GZbEKJ7NM5xBnU8TcKdvZmaO_cbd6HuGJrA9R_APXNzvw7DpCfID8-n_-FKBP6IE9klic8u2h4fOA9xPeE5xAxyGQiXsPdRAxnlHtAHXwS9pJWlWnRE3JCqPLR3v43i3Z2BGoOQC1U-dYS8G7wGsPAg3t8ckx8M8hfG210q4p1ZlgEeRyt2ODZoWYfvNXs7Aevpac2QuvxylGsXhxHvBhZKzIZvPNjn42dGlvVcma6os6LosqVOmRTV7ZK12Vdq6JRua7Ls2q4HCtdczvkpmkz21FOqiioyRtFxWHf0shl1RZDqVRVmBIOuZnZus9rZ5uBXa0qoszxYFza8kG0doA6Wp9Eh3mw3gCt_gLR6qwZd-Eqdn4ttv4rT1ns1rHdsFwSHHJnk6QvKrHitvT97ZO8vTDLE_7zCsqveNudvhlDQG22RNf9IaCb5udrd43hh9HfMrpt-TMAAP__eff-kQ">