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

    <tr>
        <th>Summary</th>
        <td>
            AND with ` == 0` and OR with ` != 0`
        </td>
    </tr>

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

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

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

<pre>
    It was difficult to title the issue. Feel free to modify it appropriately.

Consider the following functions:
```cpp
bool f_and(int x,int y)
{
  bool a = x == 0;
  bool b = y == 0;
  bool t = a & b;
  return t & !a;
}

bool f_or(int x,int y)
{
  bool a = x != 0;
  bool b = y != 0;
  bool t = a | b;
  return t | !a;
}
```

The function `f_and` can be optimized to 0, and `f_or` can be optimized to 1.

https://godbolt.org/z/nWq194nz9
https://alive2.llvm.org/ce/z/PPCfP9

FYI (original issue)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111542
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUU0FvozwQ_TXDxSqyB2LCgUObCKmX76tWK632VBljiHcdm7VN0-TXryA0TavNSish2-K9Gb_xmxEh6N4qVcHqAVbbRIxx53z180547w4haVx7rB4jOYhAWt11Wo4mkuhI1NEoEneK6BBGlZJaKUM6r9SE7l2ruyPRkYhh8G7wWkRljinQLdD787pxNuhW-TlJ54xxB2170o1WRu1sgGwhAqfnTw7D-U_jnCHds7At4FrbSF4BN9N-BCyXoOLhfCBkZgsC2Za8Tut0oJB9xJsZP97E44wLAshJcwV6FUdvJxg5AWTigkGxvS530ez8v0tG9nfJN_CL5GJzQ3KxuSX57cmvK_g6-bS4Q4DTswGcEiksaRRxQ9R7fVLt1AEUcEOEbc9E52_x2Iee2MU4zMZjDVj3rm2cianzPWB9Aqztt1-szO2p_BNdGP2iMDXmZb-ESLXEPT1tuqfy-qb6-yMBXDuve22FOXfxxYpPOqRMezsuSZuxP2ljBGAddu7w3Ix9KnsNWa1byLaMsVWOSVtlbZmVIlEV42VBcZ2zLNlVLc8krrNOFGte0HyNHSvyVUcF5XyVZzLRFVLMGGWMYc5XWUqxyxntZNMWZS5FCTlVe6HNpdBk1l7xdVGWiRGNMmEeZ0SrDm-F4TTdvppi7pqxD5BTo0MM71nmia7u_9uSg467ybf3YeB09vL_L1fYW9dxmozeVJ-eTMfd2KTS7QHr6Ypluxu8-6FkBKxnYQGwnoX_DgAA__8xz014">