| Issue |
56049
|
| Summary |
Dead Code Elimination Regression at -O3 (trunk vs. 14.0.4)
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
thetheodor
|
```c
static struct { int a; } b, c;
static int d = -1;
void foo();
int main() {
if (b.a)
d = 2 | (b.a <= 0);
for (; b.a; b.a++)
c = b;
if (!d)
foo();
}
```
`llvm-4c2bccfda3892ae13e97b6bfdbc99ec8cf5d095d (trunk) -O3` can not eliminate `foo` but `llvm-llvmorg-14.0.4 -O3` can.
Target: `x86_64-unknown-linux-gnu`
------------------------------------------------
`llvm-4c2bccfda3892ae13e97b6bfdbc99ec8cf5d095d (trunk) -O3 -S -o /dev/stdout case.c`
<details ><summary>Reduced assembly</summary><p>
```asm
main: # @main
.cfi_startproc
# %bb.0:
pushq %rax
.cfi_def_cfa_offset 16
cmpl $0, d(%rip)
je .LBB0_1
# %bb.2:
xorl %eax, %eax
popq %rcx
.cfi_def_cfa_offset 8
retq
.LBB0_1:
.cfi_def_cfa_offset 16
xorl %eax, %eax
callq foo@PLT
xorl %eax, %eax
popq %rcx
.cfi_def_cfa_offset 8
retq
.Lfunc_end0:
.size main, .Lfunc_end0-main
```
</p></details>
------------------------------------------------
`llvm-llvmorg-14.0.4 -O3 -S -o /dev/stdout case.c`
<details ><summary>Reduced assembly</summary><p>
```asm
main: # @main
.cfi_startproc
# %bb.0:
xorl %eax, %eax
retq
.Lfunc_end0:
.size main, .Lfunc_end0-main
```
</p></details>
------------------------------------------------
### Bisection
Bisected to: 6990e7477d24ff585ae86549f5280f0be65422a6
Committed by: @alexander-shaposhnikov
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs