<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/121773>121773</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[InstCombine] Commuted pattern is not handled
</td>
</tr>
<tr>
<th>Labels</th>
<td>
llvm:instcombine,
missed-optimization
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
dtcxzyw
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
dtcxzyw
</td>
</tr>
</table>
<pre>
https://godbolt.org/z/3fd93zEEq
```
define i1 @xor_logic_and_logic_or1(i1 %c, i1 %x, i1 %y) {
%o = select i1 %y, i1 true, i1 %c
%a = select i1 %c, i1 %x, i1 false
%r = xor i1 %a, %o
ret i1 %r
}
define i1 @xor_logic_and_logic_or2(i1 %c, i1 %x, i1 %y) {
%o = select i1 %y, i1 true, i1 %c
%a = select i1 %c, i1 %x, i1 false
%r = xor i1 %o, %a
ret i1 %r
}
```
```
define i1 @xor_logic_and_logic_or1(i1 %c, i1 %x, i1 %y) {
%1 = xor i1 %x, true
%r = select i1 %c, i1 %1, i1 %y
ret i1 %r
}
define i1 @xor_logic_and_logic_or2(i1 %c, i1 %x, i1 %y) {
%o = select i1 %y, i1 true, i1 %c
%a = select i1 %c, i1 %x, i1 false
%r = xor i1 %o, %a
ret i1 %r
}
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzMlN2K2zAQhZ9mfCM2SKP478IX2WQNfYpFlpRYRbZSSd4mefoir0PS7W5poaUFY4_tc2b0MXBECOYwat1A_giIKsrT5fwVECHfZWKKvfPN8jHrnDo3fYzHAHwD2AK2B6c6Z-PK-QNgewFs-V7V_PL09AXoBgq6XHSj9N6MmhhGYE1Pzj9bdzDyWYxqqZxngFX6j7kE3JLX8nQrz4A1gfIR6Iakd0eA70jQVst4k8zq6Cd9M8qrQ_zoeGfUXtigrxY_W07OLyKRRGl4Enh9beMTbrlL919ixd9g_VeobkEVs-AD1vsd_-V9szfnm6Uz_ncAHzGz-84_IfrD2_s_1vcu6926MtVwVfNaZLphJS9YWdC6yPqmrrjS1Z4KVa6p0ntJmeoqzrq85phXKjMNUswpowXLacWKVSnXTIhccqXKvGAU1lQPwtiVtS9DSorMhDDphiErS55Z0WkblvxJEuAbM4Yo3dCZUacowi0gDiYErR7cMZrBXEQ0blxiyjfJ9tBNhwBrak2I4TYrmmjndPs0hrhdeuY7snXDMEWtyFHEqP1ITCCji6QXo7JaZZO3b7POxH7qVtINgO180NfHw9G7z1pGwHYGC4DtwvbS4LcAAAD__6F1f5I">