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

    <tr>
        <th>Summary</th>
        <td>
            `add nuw i1` should simplify to `or disjoint i1` (not to `xor i1`)
        </td>
    </tr>

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

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

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

<pre>
    Today, `add nuw i1` optimizes to `xor i1`: <https://llvm.godbolt.org/z/n5fY4x8Gx>

That loses information, though.  It could instead optimize to `or disjoint i1` (<https://alive2.llvm.org/ce/z/PUwk-C>), to preserve the fact that it can't be `true + true`.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx80s1unDAQB_CnGS5WkD0GFg4-bNJu1VsP6aFHgwdwavAKD5uPp68gKFUVqSeQRjC_mf_YlPwwExko76H8ktmVx7iY1EXmqZuyNrpX8xidfQV8EFBJ65yY12fhFVRSxCv7yb9REhy36ktc3iugzwL0w8h8TaDPgBfASwi3KR-ia2PgPC4D4OUN8DKX_a_ipf72AvoryDPI8-NoWYSYKAk_93GZLPs4bwIe4zqMuRDfWXRxDU74OTFZ90E5JHERzqen6Gc-rID1J5EN_kaY77B3UEeH6sfP5993DxsJm71zFNeFEi03EjyS6G3HgjeoZ9HZGfDEoqWtNy8rCcB7sb1AJfPMGe0a3diMjDppbMoaa8xGo7Am0lK22GAhq0KXjmSlS-1k3_fUZd6gxEIpLWWjaok5ypOqCK3tbanqk4JC0mR9-Jgh8ymtZJSqVVVkwbYU0p4u4kzPYq8C4hb2YraP7tp1SFDI4BOnv79hz4HMp8TTuG89-ekafP_6v23PkT-dBTbZugTzbwqD53Ft8y5Ox5Ecj7vrEp-oY8DLzk6Al2Oum8E_AQAA__8KidmW">