public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/111515] New: [14 Regression] Missed Dead Code Elimination since r14-4089-gd45ddc2c04e
@ 2023-09-21  9:40 theodort at inf dot ethz.ch
  2023-09-21 15:21 ` [Bug tree-optimization/111515] " rguenth at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: theodort at inf dot ethz.ch @ 2023-09-21  9:40 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 111515
           Summary: [14 Regression] Missed Dead Code Elimination since
                    r14-4089-gd45ddc2c04e
           Product: gcc
           Version: unknown
            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/K9bbM4fc9

Given the following code:

void foo(void);
static struct a {
    short b;
    int c;
    char d;
    int e;
    unsigned f;
} h, j, k = {0, 4274716299}, l, *aa = &j;
static char g;
static short i;
static int m, ah;
static int *ac = &j.e;
static void n(struct a o) {
    int aj = o.c;
    int *ak = &h.e;
    *ak = g && aj;
    if (!(((aj) >= 0) && ((aj) <= 4274716299))) {
        __builtin_unreachable();
    }
    i = ah;
}
int main() {
    n(l);
    *aa = h;
    m = *ac;
    if (m < 10)
        ;
    else
        foo();
    ;
    n(k);
}

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

main:
        subq    $8, %rsp
        xorl    %edi, %edi
        call    n.isra.0
        movdqa  h(%rip), %xmm0
        movl    h+16(%rip), %eax
        movaps  %xmm0, j(%rip)
        cmpl    $9, j+12(%rip)
        movl    %eax, j+16(%rip)
        jg      .L6
.L4:
        movl    $-20250997, %edi
        xorl    %eax, %eax
        call    n.isra.0
        addq    $8, %rsp
        ret
.L6:
        call    foo
        jmp     .L4

gcc-13.2.0 -O2 eliminates the call to foo:

main:
        movl    $0, h+12(%rip)
        movl    h+16(%rip), %eax
        movdqa  h(%rip), %xmm0
        movl    %eax, j+16(%rip)
        movaps  %xmm0, j(%rip)

Bisects to r14-4089-gd45ddc2c04e

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

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

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-21  9:40 [Bug tree-optimization/111515] New: [14 Regression] Missed Dead Code Elimination since r14-4089-gd45ddc2c04e theodort at inf dot ethz.ch
2023-09-21 15:21 ` [Bug tree-optimization/111515] " rguenth at gcc dot gnu.org
2023-09-21 15:34 ` pinskia at gcc dot gnu.org
2023-09-21 15:55 ` theodort at inf dot ethz.ch
2023-10-16 11:26 ` theodort at inf dot ethz.ch
2023-12-13 13:46 ` rguenth at gcc dot gnu.org
2023-12-13 13:53 ` rguenth at gcc dot gnu.org
2023-12-14 15:54 ` rguenth at gcc dot gnu.org
2024-03-07 21:53 ` law at gcc dot gnu.org
2024-05-07  7:42 ` [Bug tree-optimization/111515] [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).