<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/76554>76554</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
missed optimization: `((a ^ b) & c) | a` -> `a | (b & c)`
</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>
Consider the following.
https://godbolt.org/z/Tzzx1aveT
```cpp
int foo(int a, int b, int c)
{
return ((a ^ b) & c) | a;
}
int bar(int a, int b, int c)
{
return a | (b & c);
}
```
Alive2 proof (I used `i16` to prevent timeout.)
https://alive2.llvm.org/ce/z/CReg2u
Original test (gcc testsuite):
https://github.com/gcc-mirror/gcc/blob/master/gcc/testsuite/gcc.dg/tree-ssa/pr109938.c
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycU91uozoQfprhxgpyxmDggos0LdK5OtJRX8CGCfFZg5Ft0t08_cokTbtStSuthMRn4-_HM4MKwYwzUQvlE5TPmVrj2fn22055795Cpt3woz26OZiBPItnYidnrXsz85gDfwZ-OMe4BBAHwA6wG92gnY258yNgdwXsXq_X73t1odfbcZD89vTLctsxc2Qn5wDrhBTgkSWg30EP2Ny51dMNMOYprn5mgDVgrRiUL4nQMEC5ERhUR6ZAPL0zn-_gYamV_ytLtUkD1vph9oXN-y0_ux6suRCyxTt3SgL_sDXQwEBys5cgOYuOLZ4uNEcWzURujfkjyK9lVptUbu1lupe6p3u9j__RiOtn33-9Gc2sLIsUYjIe-37DYTWRtvyHL3tp4nnVee-mtOj73WS8d_62AOy0dRqwm1SI9LH7STjt5ENKFz3RLgQF2C1-z5tG1HmfDa0YGtGojNp9xUUtZC2q7NwOClFyqZTmFdG-qFQlCllzKUsltdCZaZGj2CM2vOZcVHlfNKUUJ6y4Kno8VVBwmpSxjwplJoSV2kqWZZFZpcmGbeQRZ3pj20dATH-AbxNnp9cxQMGtCTF8qEQTLbWTCalxbolmMlcVjZtBHFIj_zSPkrMdiJd09Ks5kjxbvW1_04aU5P7aLd79T30E7Lb8AbDb7vczAAD__8rgGvQ">