<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/66606>66606</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[InstCombine] `a & !a` is not optimized
</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>
https://alive2.llvm.org/ce/z/e4RhjY
```llvm
define i32 @src(i32 %0) {
%1:
%2 = icmp eq i32 %0, 0
%3 = zext i1 %2 to i32
%4 = and i32 %3, %0
ret i32 %4
}
=>
define i32 @tgt(i32 %0) {
%1:
ret i32 0
}
Transformation seems to be correct!
```
Simple reproducer:
https://godbolt.org/z/YP7nEofeo
```c
int foo (int a)
{
return (a & !a);
}
```
FYI
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111431
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMU0FvozoQ_jXDxWpkj4GEA4emFKm3p_fepaeVMRPiLthZ27S7-fUrHNJ2ox5WigLDfPP5mxl_KgQzWKIaij0UTabmeHS-_n6nvHdvIetc_6s-xngKIO8BW8BWjeaVcDOOr9PG-QGw1QTYngFbyv89vjwDb4DfQ8kvvwV4-dTTwVhiRiKDnAevAXcpwIIDVgy2-7UWC7GclwK25JGBbJjR04nRD_ZR9MD4J5RMqDP9jMyIS1l0C_oTJk8YZfsri1xYEtsK8hSvuXzVs23WF9mAfPyqmzjEv-zmSs9vuP_3yoaD85OKxlkWiKawyO-Iaec96Qgobma7hun_PzOdRmKeTt71syb_fuaf-xtc37kxrrtb1vb8z9Y-ugO5G3Z9iY2N7OAcW_qzkSnA6ip9f21q6Wr2dsEoBlgyQJGAcn87wq-0t89PX0rVejPYeZXazcPZjKMCbMPRvX3r5mGjBwOyNT3IRgiRS5H1tewrWamMalFWBedc7Hh2rBF7VR50V8jtlpPIS6rkDhXnhdiVQhSZqZGj5JXYcYGS8w1XuZZd322V3Olcd5BzmpQZ369-ZkKYqS7LkpfZqDoaQ_IRoqU3lpKAuNjK10vNXTcPAXI-mhDDB0s0cUwGfLIhPripM5agaBiU_NMsS85MYNZF5k7RTOZMfTb78cacg4nHudtoNwG2yXmXx93Ju5d0hdqkKwC2SffvAAAA__8h7hni">