public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/108351] New: Dead Code Elimination Regression at -O3 (trunk vs. 12.2.0)
@ 2023-01-10 11:46 yann at ywg dot ch
  2023-01-10 12:10 ` [Bug tree-optimization/108351] [13 Regression] " rguenth at gcc dot gnu.org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: yann at ywg dot ch @ 2023-01-10 11:46 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108351
           Summary: Dead Code Elimination Regression at -O3 (trunk vs.
                    12.2.0)
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: yann at ywg dot ch
  Target Milestone: ---

Created attachment 54226
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54226&action=edit
case file

cat case.c #51
struct a {
  int b;
} b;
static short c = 7, d, e, a, k;
int g;
struct a h;
int i;
int j;
void foo();
static struct a f(int l, unsigned short m) {
  a = e;
  k = d = j < i;
  if (m)
    return h;
  foo();
  return b;
}
int main() {
  for (; g;)
    f(1, c);
  f(7, 7);
  f(9, 7);
}

`gcc-cb93c5f8008b95743b741d6f1842f9be50c6985c (trunk) -O3` can not eliminate
`foo` but `gcc-releases/gcc-12.2.0 -O3` can.

`gcc-cb93c5f8008b95743b741d6f1842f9be50c6985c (trunk) -O3 -S -o /dev/stdout
case.c`
--------- OUTPUT ---------
f.isra.0:
.LFB3:
        .cfi_startproc
        testw   %di, %di
        je      .L4
        ret
        .p2align 4,,10
        .p2align 3
.L4:
        xorl    %eax, %eax
        jmp     foo
        .cfi_endproc
.LFE3:
        .size   f.isra.0, .-f.isra.0
        .section        .text.startup,"ax",@progbits
        .p2align 4
        .globl  main
        .type   main, @function
main:
.LFB1:
        .cfi_startproc
        movl    g(%rip), %eax
        testl   %eax, %eax
        je      .L6
.L7:
        jmp     .L7
        .p2align 4,,10
        .p2align 3
.L6:
        subq    $8, %rsp
        .cfi_def_cfa_offset 16
        movl    $7, %edi
        call    f.isra.0
        movl    $7, %edi
        call    f.isra.0
        xorl    %eax, %eax
        addq    $8, %rsp
        .cfi_def_cfa_offset 8
        ret
---------- END OUTPUT ---------


`gcc-releases/gcc-12.2.0 -O3 -S -o /dev/stdout case.c`
--------- OUTPUT ---------
main:
.LFB1:
        .cfi_startproc
        movl    g(%rip), %eax
        testl   %eax, %eax
        je      .L4
.L5:
        jmp     .L5
        .p2align 4,,10
        .p2align 3
.L4:
        xorl    %eax, %eax
        ret
---------- END OUTPUT ---------


Bisects to:
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=feeb0d68f1c7085199c3734e6517a3a4b58309ef

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

end of thread, other threads:[~2023-11-24 15:47 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-10 11:46 [Bug tree-optimization/108351] New: Dead Code Elimination Regression at -O3 (trunk vs. 12.2.0) yann at ywg dot ch
2023-01-10 12:10 ` [Bug tree-optimization/108351] [13 Regression] " rguenth at gcc dot gnu.org
2023-01-10 14:41 ` [Bug tree-optimization/108351] [13 Regression] Dead Code Elimination Regression at -O3 since r13-4240-gfeeb0d68f1c708 marxin at gcc dot gnu.org
2023-01-10 22:48 ` pinskia at gcc dot gnu.org
2023-02-15  9:09 ` yinyuefengyi at gmail dot com
2023-02-15  9:15 ` yinyuefengyi at gmail dot com
2023-02-17 12:52 ` jamborm at gcc dot gnu.org
2023-04-08 14:38 ` law at gcc dot gnu.org
2023-04-26  6:57 ` [Bug tree-optimization/108351] [13/14 " rguenth at gcc dot gnu.org
2023-07-27  9:25 ` rguenth at gcc dot gnu.org
2023-11-24 12:43 ` sjames at gcc dot gnu.org
2023-11-24 14:56 ` yann at ywg dot ch
2023-11-24 15:47 ` jamborm 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).