<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=http://email.email.llvm.org/c/eJzFVMGOmzAQ_RpzsYrALgEOHHY3rfoBvVcGT8BdY1PbJE2_voMh2STSVqp6qGWZGebN-PkxprXy3JBdts6OsOdlZnuSPbXWaros36wjrFrdnLAXupqMsJqSckNTHA7C7AyCKBZZAHwLknK_GZedNjeuPRhwIoDHtKrTwvQ051j8FvOQeE_rwmnJ4ZHJO4MwTsnH7P3s61GWYaDXa1YBXt3HunG6jWGJxZIPKA_BwIoS-j6EWv34gyZf7AmO4KgKtBMG0aM9AkVLGR_c3AVlDZ71f0tknaYXGeRVhkexkPsVdRVL_PwrQZ5xe8Dzj7MOatKqE4sE9K13MIYpwkiNDyq0AyHP6W2Jr4PyUc1BTBMYehpwOQASx47zQS568qdJz57wl3hc_okGS8OAAE-1eoVliyvSgZw7wDdpIhsua16LRMxhsK4RR_Wqjiqck9npZghh8ksO-4yzV2GY27SzIzpaHy-PD5Oz36EL6CrvZ_BoFLzIWDI0UMlq18qy5Jmsd7JqGchMSCjrtttBVSRatKB9Qwq8v8zAicYSaJNin_w7A9WwjLEs53nOWMGyFKA8HKAUeZnnos47bBkYhdLpUie1rk9cE0u2c-8xqJUP_i0ovFe9AYiEkWFQQUcnXn98Q0dkAJLaKahR_RJbv6-_HiGlil_fWLwe1uBFCYjFT9VuXWJdEk_QRPq_AWeaZS8>53502</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang] missed optimization: bool addition not converted to boolean or
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
avikivity
</td>
</tr>
</table>
<pre>
```c++
bool bool_or(bool b1, bool b2) {
return b1 + b2;
}
```
generates (clang 13)
```
bool_or(bool, bool): # @bool_or(bool, bool)
negl %esi
cmpl %esi, %edi
setne %al
retq
```
However it can remove an instruction:
```
bool_or(bool, bool): # @bool_or(bool, bool)
orl %edi, %esi
mov %esi, %ax
retq
```
Boolean multiplication generates an `andl` already.
This can happen when feeding std::plus<bool> to things like `std::reduce`.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzFU8GO2yAQ_Rp8QbUMjuP44MNm06of0HuFzdimi8EFnDT9-g52kk0ibaWeihAMnjczbx64sfJck222zpbwfZzZgWQvjbWaxuW7dYTv1iMj_JWuJie8oqS8oCkOB2F2BkEUk0RAfnGS8nAxrpUux2XtwYATATyG7VotTE9ZjsnvMU-Bj7SunGJMvjD5YBCeU7LJPo6-tRKHgV6vUQV49ehrx-nehymiJZ9QHoKBFSX0owu1-vkXTb7aExzBURVoKwyiR3sEipYyPri5Dcoa7PV_S2SdplcZ5E2GZ7GQ-w11E0v8-idB9lgesP9x1kFNWrUiSkDf3w76MEQYqXGjQjsQ8pzep_g2KL-oOYhpAkNPAy4dIHF8cT7IqGf-MunZk_x1aTf_TIOlYUCAp1q9QSxxQzqQcwv4JU1kncsqr0QSVNBQk2K_vGNSHOiovAdJ7RTUqH6Ly8Wt_5CQUi1tGIv3bA3eeEAs1mwu7VqXzE7XQwiTj1X5F5y9CsPcpK0d8aD18bp9mpz9AW3AIxadwaNR5EXGk6HusqJhbVFtKrGpmlJs0cy73VaWnWSskIkWDWgfqRPODZzokgJtbCJRNc84z1jOGOcFz1KAsuugFKxkTFSsxScDo1A6jTxS6_rE1QulZu49OrXywb87hfeqN7AoFfOLOQzW1eKo3tRRhXOyFK8X8n8APPlO-w">