public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "theodort at inf dot ethz.ch" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/110903] New: [14 Regression] Dead Code Elimination Regression since r14-1597-g64d90d06d2d Date: Fri, 04 Aug 2023 17:39:23 +0000 [thread overview] Message-ID: <bug-110903-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110903 Bug ID: 110903 Summary: [14 Regression] Dead Code Elimination Regression since r14-1597-g64d90d06d2d Product: gcc Version: 14.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: --- https://godbolt.org/z/7of4jjM3K Given the following code: void foo(void); static char b, c; static short e, f; static int g = 41317; static int(a)(int h, int i) { return h + i; } static int(d)(int h, int i) { return i ? h : 0; } int main() { { char j; short k; for (; g >= 10; g = (short)g) { int l = 1, m = 0; j = 8 * k; k = j <= 0; f = c + 3; for (; c < 2; c = f) { char n = 4073709551615; if (!(((m) >= 0) && ((m) <= 0))) { __builtin_unreachable(); } if (g) ; else { if ((m = k, (b = a(d(l, k), e) && n) || l) < k) foo(); e = l = 0; } } } } } gcc-trunk -O3 does not eliminate the call to foo: main: movl g(%rip), %edi cmpl $9, %edi jle .L25 pushq %rbp movl %edi, %ecx movl $1, %ebp movl $1, %esi pushq %rbx movl $1, %ebx subq $8, %rsp movzbl c(%rip), %edx movsbw %dl, %ax addl $3, %eax movw %ax, f(%rip) cmpb $1, %dl jg .L12 .p2align 4,,10 .p2align 3 .L6: testl %edi, %edi je .L7 movb %al, c(%rip) movsbw %al, %dx cmpb $1, %al jle .L6 .L9: movswl %di, %ecx movl %ecx, g(%rip) cmpl $9, %ecx jle .L17 addl $3, %edx movw %dx, f(%rip) .L12: movswl %cx, %eax cmpw $9, %cx jle .L29 .L4: jmp .L4 .p2align 4,,10 .p2align 3 .L7: movswl e(%rip), %ecx movl %ebx, %edx andl %esi, %edx addl %ecx, %edx orl %esi, %edx jne .L10 testb %bpl, %bpl jne .L30 .L10: xorl %edx, %edx movb %al, c(%rip) movw %dx, e(%rip) movsbw %al, %dx cmpb $1, %al jg .L9 xorl %esi, %esi jmp .L6 .p2align 4,,10 .p2align 3 .L30: call foo movzwl f(%rip), %eax movl g(%rip), %edi jmp .L10 .L29: movl %eax, g(%rip) .L17: addq $8, %rsp xorl %eax, %eax popq %rbx popq %rbp ret .L25: xorl %eax, %eax ret gcc-13.2.0 -O3 eliminates the call to foo: main: movl g(%rip), %esi movl %esi, %ecx cmpl $9, %esi jle .L14 movzbl c(%rip), %eax movsbw %al, %dx addl $3, %edx movw %dx, f(%rip) cmpb $1, %al jg .L12 xorl %eax, %eax testb %al, %al movl %edx, %eax je .L6 cmpb $1, %dl jg .L22 .L7: jmp .L7 .p2align 4,,10 .p2align 3 .L22: movb %dl, c(%rip) .L8: movswl %si, %ecx movl %ecx, g(%rip) cmpl $9, %ecx jle .L14 addl $3, %eax cbtw movw %ax, f(%rip) .L12: movswl %cx, %eax cmpw $9, %cx jle .L23 .L4: jmp .L4 .p2align 4,,10 .p2align 3 .L6: movb %dl, c(%rip) cmpw $1, %dx jg .L8 .p2align 4,,10 .p2align 3 .L9: movl g(%rip), %eax testl %eax, %eax jne .L9 movw $0, e(%rip) movb %dl, c(%rip) .L23: movl %eax, g(%rip) .L14: xorl %eax, %eax ret Bisects to r14-1597-g64d90d06d2d
next reply other threads:[~2023-08-04 17:39 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-08-04 17:39 theodort at inf dot ethz.ch [this message] 2023-08-04 17:58 ` [Bug tree-optimization/110903] " pinskia at gcc dot gnu.org 2023-08-04 18:37 ` [Bug tree-optimization/110903] [12/13/14 Regression] Dead Code Elimination Regression pinskia at gcc dot gnu.org 2023-11-03 17:39 ` tkoenig at gcc dot gnu.org 2023-11-03 17:51 ` pinskia at gcc dot gnu.org 2023-11-04 16:29 ` [Bug tree-optimization/110903] [12/13 " tkoenig at gcc dot gnu.org 2023-11-04 20:37 ` tkoenig at gcc dot gnu.org 2023-11-04 20:41 ` [Bug tree-optimization/110903] [12/13 Regression] Dead Code Elimination Regression since r12-4526-gd8edfadfc7a979 pinskia at gcc dot gnu.org 2024-05-07 7:41 ` rguenth at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-110903-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).