public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "yann at ywg dot ch" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/108358] New: Dead Code Elimination Regression at -Os (trunk vs. 12.2.0)
Date: Tue, 10 Jan 2023 13:03:03 +0000	[thread overview]
Message-ID: <bug-108358-4@http.gcc.gnu.org/bugzilla/> (raw)

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

             reply	other threads:[~2023-01-10 13:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-10 13:03 yann at ywg dot ch [this message]
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
2024-05-21  9:13 ` [Bug tree-optimization/108358] [13/14/15 " jakub 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-108358-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: link
Be 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).