| Issue |
84432
|
| Summary |
Missed optimization: x*(x||(b&&c)) => x
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
ZY546
|
https://godbolt.org/z/sYzY84En5
```cpp
int a,b;
int c;
void func(int x){
a=x*(x||(b&&c));
}
```
Clang -O3:
```asm
func(int): # @func(int)
mov eax, 1
test edi, edi
je .LBB0_1
imul eax, edi
mov dword ptr [rip + a], eax
ret
.LBB0_1: # %lor.rhs
cmp dword ptr [rip + b], 0
setne al
cmp dword ptr [rip + c], 0
setne cl
and cl, al
movzx eax, cl
imul eax, edi
mov dword ptr [rip + a], eax
ret
```
Expected code (GCC -O3)
```asm
func(int):
mov DWORD PTR a[rip], edi
ret
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs