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/108351] New: Dead Code Elimination Regression at -O3 (trunk vs. 12.2.0)
Date: Tue, 10 Jan 2023 11:46:47 +0000	[thread overview]
Message-ID: <bug-108351-4@http.gcc.gnu.org/bugzilla/> (raw)

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

             reply	other threads:[~2023-01-10 11:46 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-10 11:46 yann at ywg dot ch [this message]
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

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-108351-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).