<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/118036>118036</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Does not CSE b&c in 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>
Alcaro
</td>
</tr>
</table>
<pre>
```c++
// Type your code here, or load an example.
void square(unsigned board, unsigned& e, unsigned& f) {
unsigned a = (board >> 1) & board;
unsigned b = (board >> 5) & board;
unsigned c = (board << 5) & board;
e = (b&c);
f = (a&b&c);
}
void cube(unsigned board, unsigned& e, unsigned& f) {
unsigned a = (board >> 1) & board;
unsigned b = (board >> 5) & board;
unsigned c = (board << 5) & board;
e = (b&c);
f = (a&(b&c));
}
```
https://godbolt.org/z/YvKoW8jza
Expected: Since the only difference is an extra paren on the f line, the b&c should be deemed a common subexpression and deduplicated
Actual:
```asm
square(unsigned int, unsigned int&, unsigned int&):
mov eax, edi
shr eax
mov ecx, edi
shl ecx, 5
mov r8d, ecx
and r8d, edi
and eax, edi
shr edi, 5
and r8d, edi
mov dword ptr [rsi], r8d
and ecx, edi
and ecx, eax
mov dword ptr [rdx], ecx
ret
cube(unsigned int, unsigned int&, unsigned int&):
mov eax, edi
shr eax, 5
mov ecx, edi
shl ecx, 5
and ecx, eax
and ecx, edi
shr edi
mov dword ptr [rsi], ecx
and ecx, edi
mov dword ptr [rdx], ecx
ret
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsVU2PozgQ_TXFpTSRYwKBAwe607nscVZa7dHYlY5HBrO2yaTn16_sfGfZ3tWcByEh_Oo9V73yh_Bevw9EDRQvUGwyMYW9dU1rpHA266z6aKBkp1cCf4kva4FvgW_x94-R8MNODqVVhHtyBPwVrUNjhUIxIB1FPxpaAGsPViv0f00iBlXTkOZV2FnhVGRdRoCXSM8DO-A1wjrOfR1HgZBvEHiVNBDyN8jfcJlCeXlWzhMH8UbrZmnFHO3Kkc-cV8hf5zmISNdo4KUEXt-g3QUSwMtHGNabi01y6n6ZdDbpPuLRquvCBNbuQxg95OeV-W5VZ01YWPcOfPsD-PbPw2_2j-rbDxF5rH07jiQDKchb_KoHSRj2hHYwH6j0bkeO4pj2pzUcnMBROBrQDilwh0YPyf_4l9JDv7eTUdgRKqI-OS9t39sB_dTRcXTkvbYDikGhIjWNRksRU0gJtTJMwsQC7uoSvgfW_nPP6CHc9_70X84O1SdJPD-9PaQviWMMJ6XvQL93CZgJl7Ph5h4sZniuSqs2RtzAaMA9-CB6Af81wQQq_Tzjp6KXdNR36xSOwSEUL85rKDYxOHJYe5t6rthncNamR311POs_lu8onFr-vMl_oqv_2c47cK4_j6V-0tBPy5837r5Z_7sV8yvlUfhn3L7sqEw1uarzWmTULNc5r_IlZ2W2b4jXS1nxapWLXV2WZV3salWsu3VZKiFEkemGM75aLnnFOWNstRDVumbVSq5KKklJDitGvdBmYcyhjydPpr2fqFkuK5aXmREdGZ-uWc4H-o4JBc7jreuaSPrSTe8eVsxoH_xNJuhgqNlY8jjYgK9f384njh7weotkkzPN0yGow37qFtL2wLdR7fz5Mjr7jWQAvk05eODbc5KHhv8dAAD__01PQO8">