<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/62753>62753</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[InstSimplify] X == Y ? 0 : X xor Y --> X xor Y
</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>
This issue is similar to https://github.com/llvm/llvm-project/issues/62238.
```c
int foo(int a, int b)
{
return (a == b) ? a ^ b : a ^ b;
}
```
https://godbolt.org/z/G19773qqb
Clang15.0.0
```asm
foo(int, int): # @foo(int, int)
mov eax, edi
xor eax, esi
ret
```
Clang(trunk)
```asm
foo(int, int): # @foo(int, int)
mov ecx, esi
xor ecx, edi
xor eax, eax
cmp edi, esi
cmovne eax, ecx
ret
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykk09zmzwQxj_NctGYESuw4MAhCeGd99wekqMA2VYjkCMJx-mn7yBM_KedtJ1qPNbKj3a9z8JPOKe2g5QlZPeQVZEY_c7Y8mUlrDVvLmpM915-3SlHlHOjJMoRp3qlhSXekJ33ewfsDrAGrLfK78Ymbk0PWGt9WLbV3ppvsvWAdSjiAOs1IstjoBXQu9P3ms6fdj6rwZONMYD5FAnABzIFDWBxSuD3c0AIIVb60Q4EMBcEWAWsCjcJsJoIAtkjaQiwuyUGdr8UqW7-_rKnG3-ma4z2sbFbwPo7YP1fUnDOXl-by6QHLYZtksU0pjelhevnXz58nVxNnljw8ckCZARS-qvcjzFMqzeHsEtxnK7ITl3rR2OvdLfoVvpPZhFsAebejsPL-SH8qbe_7r696e6i-0X7nTNxvNbbfj_rnbqu3fbmMMhzYnuT-PNkoq5kXcEKEckyWecp5rjOimhX5hlvOkmR0zRP04YzmgrZphvaiI3IuyxSJVJkNEs4pQlnRdzRDbIiSQWnjCcth5TKXigdT-xML1sUqCnXyDMWadFI7QKuiIN8m7kExIleWwbemnHrIKVaOe_OVbzyOnD-_-D8F9Xvtdq8Q1aRp4WY54ALDaA8hWk-k9UK2ONyikary3-BnmfsRwAAAP__2OUzjA">