public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/103280] New: [12 Regression] Dead Code Elimination Regression at -O3 (trunk vs 11.2.0)
@ 2021-11-16 18:13 theodort at inf dot ethz.ch
2021-11-16 20:08 ` [Bug tree-optimization/103280] " aldyh at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: theodort at inf dot ethz.ch @ 2021-11-16 18:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103280
Bug ID: 103280
Summary: [12 Regression] Dead Code Elimination Regression at
-O3 (trunk vs 11.2.0)
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: theodort at inf dot ethz.ch
Target Milestone: ---
cat case.c
void bar(void);
void foo(void);
static char a;
int main() {
short b = -25536;
for (; a; a = 1) {
bar();
if (b)
b = 1;
else
foo();
}
}
trunk cannot eliminate the call to foo but 11.2.0 can:
gcc-11.2.0 -O3 -S -o /dev/stdout case.c
main:
.LFB0:
.cfi_startproc
cmpb $0, a(%rip)
je .L2
pushq %rax
.cfi_def_cfa_offset 16
call bar
.p2align 4,,10
.p2align 3
.L3:
movb $1, a(%rip)
call bar
movb $1, a(%rip)
call bar
jmp .L3
.p2align 4,,10
.p2align 3
.L2:
.cfi_def_cfa_offset 8
xorl %eax, %eax
ret
.cfi_endproc
gcc-trunk -O3 -S -o /dev/stdout case.c
main:
.LFB0:
.cfi_startproc
cmpb $0, a(%rip)
je .L2
pushq %rbx
.cfi_def_cfa_offset 16
.cfi_offset 3, -16
movl $-25536, %ebx
jmp .L4
.p2align 4,,10
.p2align 3
.L5:
movl $1, %ebx
.L3:
movb $1, a(%rip)
.L4:
call bar
testw %bx, %bx
jne .L5
call foo
jmp .L3
.p2align 4,,10
.p2align 3
.L2:
.cfi_def_cfa_offset 8
.cfi_restore 3
xorl %eax, %eax
ret
.cfi_endproc
gcc-trunk -v
Using built-in specs.
Target: x86_64-pc-linux-gnu
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.0.0 20211116 (experimental) (GCC)
Started with
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=e53fbb17839723ea1697fcbaf76b1c092675eaaf
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug tree-optimization/103280] [12 Regression] Dead Code Elimination Regression at -O3 (trunk vs 11.2.0)
2021-11-16 18:13 [Bug tree-optimization/103280] New: [12 Regression] Dead Code Elimination Regression at -O3 (trunk vs 11.2.0) theodort at inf dot ethz.ch
@ 2021-11-16 20:08 ` aldyh at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: aldyh at gcc dot gnu.org @ 2021-11-16 20:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103280
Aldy Hernandez <aldyh at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |DUPLICATE
--- Comment #1 from Aldy Hernandez <aldyh at gcc dot gnu.org> ---
Duplicate.
There's a threading candidate in 2->6->3->5 that would elide the call to foo(),
but doing so would peel off an iteration. This is another case of the first
iteration of a loop having dead code.
*** This bug has been marked as a duplicate of bug 102981 ***
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-11-16 20:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-16 18:13 [Bug tree-optimization/103280] New: [12 Regression] Dead Code Elimination Regression at -O3 (trunk vs 11.2.0) theodort at inf dot ethz.ch
2021-11-16 20:08 ` [Bug tree-optimization/103280] " aldyh at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).