public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/110931] New: [14 Regression] Dead Code Elimination Regression since r14-2890-gcc2003cd875
@ 2023-08-07 10:33 theodort at inf dot ethz.ch
  2023-08-07 14:57 ` [Bug tree-optimization/110931] " pinskia at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: theodort at inf dot ethz.ch @ 2023-08-07 10:33 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110931

            Bug ID: 110931
           Summary: [14 Regression] Dead Code Elimination Regression since
                    r14-2890-gcc2003cd875
           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/zPTeo8Mj9

Given the following code:

void foo(void);
static int a = 7, c;
static int *d = &a, *e;
static int **f = &e;
static short g;
static char(h)(char b) {
    if (!(((b) >= 1) && ((b) <= 1))) {
        __builtin_unreachable();
    }
    return 0;
}
static void k(unsigned i) {
    short j = i;
    if (j)
        ;
    else {
        h(i);
        if ((e && i) <= 0)
            ;
        else
            foo();
        *f = &c;
    }
    h(0 >= 0);
}
int main() {
    int l = *d;
    g = l;
    k(g);
}

gcc-trunk -O3 does not eliminate the call to foo:

main:
        cmpw    $0, a(%rip)
        jne     .L5
        cmpq    $0, e(%rip)
        je      .L6
        pushq   %rax
        call    foo
        xorl    %eax, %eax
        movq    $c, e(%rip)
        popq    %rdx
        ret
.L6:
        movq    $c, e(%rip)
.L5:
        xorl    %eax, %eax
        ret

gcc-13.2.0 -O3 eliminates the call to foo:

main:
        xorl    %eax, %eax
        ret

Bisects to r14-2890-gcc2003cd875

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-05-07  7:41 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-07 10:33 [Bug tree-optimization/110931] New: [14 Regression] Dead Code Elimination Regression since r14-2890-gcc2003cd875 theodort at inf dot ethz.ch
2023-08-07 14:57 ` [Bug tree-optimization/110931] " pinskia at gcc dot gnu.org
2023-08-07 15:11 ` pinskia at gcc dot gnu.org
2023-08-07 15:25 ` pinskia at gcc dot gnu.org
2023-08-07 16:07 ` pinskia at gcc dot gnu.org
2023-08-09  1:35 ` pinskia at gcc dot gnu.org
2024-03-07 23:25 ` law at gcc dot gnu.org
2024-03-09  6:50 ` law at gcc dot gnu.org
2024-05-07  7:41 ` [Bug tree-optimization/110931] [14/15 " rguenth 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).