public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/108358] New: Dead Code Elimination Regression at -Os (trunk vs. 12.2.0)
@ 2023-01-10 13:03 yann at ywg dot ch
  2023-01-10 14:47 ` [Bug tree-optimization/108358] [13 Regression] Dead Code Elimination Regression at -Os since r13-3378-gf6c168f8c06047 marxin at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: yann at ywg dot ch @ 2023-01-10 13:03 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108358
           Summary: Dead Code Elimination Regression at -Os (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 54233
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54233&action=edit
presented code as file

cat case.c #25
struct a {
  int b;
  int c;
  short d;
  int e;
  int f;
};
struct g {
  struct a f;
  struct a h;
};
int i;
void foo();
void bar31_(void);
int main() {
  struct g j, l = {2, 1, 6, 1, 1, 7, 5, 1, 0, 1};
  for (; i; ++i)
    bar31_();
  j = l;
  struct g m = j;
  struct g k = m;
  if (k.h.b)
    ;
  else
    foo();
}

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

`gcc-cb93c5f8008b95743b741d6f1842f9be50c6985c (trunk) -Os -S -o /dev/stdout
case.c`
--------- OUTPUT ---------
main:
.LFB0:
        .cfi_startproc
        pushq   %rbx
        .cfi_def_cfa_offset 16
        .cfi_offset 3, -16
        movl    $.LC0, %esi
        movl    $10, %ecx
        subq    $80, %rsp
        .cfi_def_cfa_offset 96
        leaq    40(%rsp), %rdi
        leaq    40(%rsp), %rbx
        rep movsl
.L2:
        cmpl    $0, i(%rip)
        je      .L7
        call    bar31_
        incl    i(%rip)
        jmp     .L2
.L7:
        movq    %rsp, %rdi
        movl    $10, %ecx
        movq    %rbx, %rsi
        rep movsl
        cmpl    $0, 20(%rsp)
        jne     .L4
        xorl    %eax, %eax
        call    foo
.L4:
        addq    $80, %rsp
        .cfi_def_cfa_offset 16
        xorl    %eax, %eax
        popq    %rbx
        .cfi_def_cfa_offset 8
        ret
---------- END OUTPUT ---------


`gcc-releases/gcc-12.2.0 -Os -S -o /dev/stdout case.c`
--------- OUTPUT ---------
main:
.LFB0:
        .cfi_startproc
        cmpl    $0, i(%rip)
        jne     .L7
        xorl    %eax, %eax
        ret
.L7:
        pushq   %rax
        .cfi_def_cfa_offset 16
.L3:
        call    bar31_
        incl    i(%rip)
        cmpl    $0, i(%rip)
        jne     .L3
        xorl    %eax, %eax
        popq    %rdx
        .cfi_def_cfa_offset 8
        ret
---------- END OUTPUT ---------


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

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

* [Bug tree-optimization/108358] [13 Regression] Dead Code Elimination Regression at -Os since r13-3378-gf6c168f8c06047
  2023-01-10 13:03 [Bug tree-optimization/108358] New: Dead Code Elimination Regression at -Os (trunk vs. 12.2.0) yann at ywg dot ch
@ 2023-01-10 14:47 ` marxin at gcc dot gnu.org
  2023-02-21 13:20 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: marxin at gcc dot gnu.org @ 2023-01-10 14:47 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Dead Code Elimination       |[13 Regression] Dead Code
                   |Regression at -Os (trunk    |Elimination Regression at
                   |vs. 12.2.0)                 |-Os since
                   |                            |r13-3378-gf6c168f8c06047
   Target Milestone|---                         |13.0
   Last reconfirmed|                            |2023-01-10
     Ever confirmed|0                           |1
                 CC|                            |jamborm at gcc dot gnu.org,
                   |                            |marxin at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW

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

* [Bug tree-optimization/108358] [13 Regression] Dead Code Elimination Regression at -Os since r13-3378-gf6c168f8c06047
  2023-01-10 13:03 [Bug tree-optimization/108358] New: Dead Code Elimination Regression at -Os (trunk vs. 12.2.0) yann at ywg dot ch
  2023-01-10 14:47 ` [Bug tree-optimization/108358] [13 Regression] Dead Code Elimination Regression at -Os since r13-3378-gf6c168f8c06047 marxin at gcc dot gnu.org
@ 2023-02-21 13:20 ` rguenth at gcc dot gnu.org
  2023-03-27 11:56 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-02-21 13:20 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2023-01-10 00:00:00         |2023-2-21

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Re-confirmed but not analyzed yet.

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

* [Bug tree-optimization/108358] [13 Regression] Dead Code Elimination Regression at -Os since r13-3378-gf6c168f8c06047
  2023-01-10 13:03 [Bug tree-optimization/108358] New: Dead Code Elimination Regression at -Os (trunk vs. 12.2.0) yann at ywg dot ch
  2023-01-10 14:47 ` [Bug tree-optimization/108358] [13 Regression] Dead Code Elimination Regression at -Os since r13-3378-gf6c168f8c06047 marxin at gcc dot gnu.org
  2023-02-21 13:20 ` rguenth at gcc dot gnu.org
@ 2023-03-27 11:56 ` rguenth at gcc dot gnu.org
  2023-04-08 14:37 ` law at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-03-27 11:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Both -O2 and -O1 can optimize away the call to foo.  For -Os we end up with

  <bb 2> [local count: 118111600]:
  l = *.LC0;
  goto <bb 4>; [100.00%]

  <bb 3> [local count: 955630225]:
  bar31_ ();
  i.0_1 = i;
  _2 = i.0_1 + 1;
  i = _2;

  <bb 4> [local count: 1073741824]:
  i.1_3 = i;
  if (i.1_3 != 0)
    goto <bb 3>; [89.00%]
  else
    goto <bb 5>; [11.00%]

  <bb 5> [local count: 118111600]:
  j = l;
  m$h$b_18 = j.h.b;
  if (m$h$b_18 != 0)
    goto <bb 7>; [67.00%]
  else
    goto <bb 6>; [33.00%]

  <bb 6> [local count: 38976828]:
  foo ();

but FREs looking through the j = l copy causes us to fail disambiguating
against the cycle because of 'abort_on_visited' which I think is a bit
overeager here.

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

* [Bug tree-optimization/108358] [13 Regression] Dead Code Elimination Regression at -Os since r13-3378-gf6c168f8c06047
  2023-01-10 13:03 [Bug tree-optimization/108358] New: Dead Code Elimination Regression at -Os (trunk vs. 12.2.0) yann at ywg dot ch
                   ` (2 preceding siblings ...)
  2023-03-27 11:56 ` rguenth at gcc dot gnu.org
@ 2023-04-08 14:37 ` law at gcc dot gnu.org
  2023-04-26  6:57 ` [Bug tree-optimization/108358] [13/14 " rguenth at gcc dot gnu.org
  2023-07-27  9:25 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: law at gcc dot gnu.org @ 2023-04-08 14:37 UTC (permalink / raw)
  To: gcc-bugs

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

Jeffrey A. Law <law at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |law at gcc dot gnu.org
           Priority|P3                          |P2

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

* [Bug tree-optimization/108358] [13/14 Regression] Dead Code Elimination Regression at -Os since r13-3378-gf6c168f8c06047
  2023-01-10 13:03 [Bug tree-optimization/108358] New: Dead Code Elimination Regression at -Os (trunk vs. 12.2.0) yann at ywg dot ch
                   ` (3 preceding siblings ...)
  2023-04-08 14:37 ` law at gcc dot gnu.org
@ 2023-04-26  6:57 ` rguenth at gcc dot gnu.org
  2023-07-27  9:25 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-04-26  6:57 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|13.0                        |13.2

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 13.1 is being released, retargeting bugs to GCC 13.2.

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

* [Bug tree-optimization/108358] [13/14 Regression] Dead Code Elimination Regression at -Os since r13-3378-gf6c168f8c06047
  2023-01-10 13:03 [Bug tree-optimization/108358] New: Dead Code Elimination Regression at -Os (trunk vs. 12.2.0) yann at ywg dot ch
                   ` (4 preceding siblings ...)
  2023-04-26  6:57 ` [Bug tree-optimization/108358] [13/14 " rguenth at gcc dot gnu.org
@ 2023-07-27  9:25 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-27  9:25 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|13.2                        |13.3

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 13.2 is being released, retargeting bugs to GCC 13.3.

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

end of thread, other threads:[~2023-07-27  9:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-10 13:03 [Bug tree-optimization/108358] New: Dead Code Elimination Regression at -Os (trunk vs. 12.2.0) yann at ywg dot ch
2023-01-10 14:47 ` [Bug tree-optimization/108358] [13 Regression] Dead Code Elimination Regression at -Os since r13-3378-gf6c168f8c06047 marxin at gcc dot gnu.org
2023-02-21 13:20 ` rguenth at gcc dot gnu.org
2023-03-27 11:56 ` rguenth at gcc dot gnu.org
2023-04-08 14:37 ` law at gcc dot gnu.org
2023-04-26  6:57 ` [Bug tree-optimization/108358] [13/14 " rguenth at gcc dot gnu.org
2023-07-27  9:25 ` 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).