Issue |
91431
|
Summary |
Regression on trunk: missed optimization for dead code, work as expected on clang-18
|
Labels |
new issue
|
Assignees |
|
Reporter |
ZY546
|
Reduced code:
https://godbolt.org/z/chrT7v9vo
```cpp
int m;
void func(short a, short b) {
short f = 1;
if(
(f ? ((a ? b : 0) ? 1 : 0) : 0)
-
(f ? ((a ? b : 0) ? 1 : 0) : 0)
){
m=1;
}
}
```
Clang-trunk:
```asm
func(short, short): # @func(short, short)
test si, si
setne al
sete cl
test di, di
setne dl
sete sil
and dl, al
or sil, cl
cmp dl, sil
jne .LBB0_2
mov dword ptr [rip + m], 1
.LBB0_2: # %if.end
ret
```
Expected code (Clang-18.1.0):
```asm
func(short, short): # @func(short, short)
ret
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs