<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/69050>69050</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Simplification for `(~a & b) && ~a`
</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>
GCC outputs the same sequence of instructions for the following two functions. Clang doesn't simplify the function `foo`. The transformation from `foo` to `bar` can be proved.
```cpp
int foo(int a, int b)
{
return (~a & b) && ~a;
}
int bar(int a, int b)
{
return (~a & b) && b;
}
```
Godbolt: https://godbolt.org/z/1cfP7Y5x6
Alive2: https://alive2.llvm.org/ce/z/HDJVkD
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykUsuOnDAQ_BpzaS2ym8fAgcPsjNgop0iJIuVooBmcNTaxzUw2h_32iMfuRnmcIiFR7q7qanBJ79XFEFUsu2fZOZJzGKyrHu-kc_bmo8Z2T9XD6QR2DtMcPISBwMuRwNO3mUxLYHtQxgc3t0FZ46G3bmX1Vmt7U-YC4Wahn83Wj-GkpblAZ8kbhocAXo2TVv3Tptp5wHLeW8tyHsOngSA4aXxv3SjXbu_s-EaBYJdDI91yaKWBhmBy9kpdzPiZ8SPL-fa007RVlAmwqLFYkGR4ggU0DMtdcrjfAAA4CrMzwLB4lsAwX2kLWPCzZMn9i-a8g1ePZan_92j-YvHySb86PtiusTqw5AhDCJNnyZFhzbC-bI3YugvD-gfDWrT9h8OX7Hu-KY9aXQn_FMq1Hmt9HXdxS_uEd-f3nx_PUVclXZmUMqJK5OUBC8x4Gg2VKATyruv6g-hFnjd9liVNKmVZFIXMiSJVIcdEcJEKgSJN4qQ8pISZKERLWcZblnIapdKv7pHyfqYqL3nGIy0b0n5NLqKhG6xNhrgE2VWL5q6ZL56lXCsf_NuUoIKm6uOWO9XukbJuCdE_7zjn0ex09dtvVWGYm7i1I8N6mb-_7iZnv1IbGNbrVp5hvW79MwAA___kkwbc">