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/107822] New: Dead Code Elimination Regression at -Os (trunk vs. 12.2.0)
Date: Tue, 22 Nov 2022 17:51:01 +0000	[thread overview]
Message-ID: <bug-107822-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 107822
           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 53945
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53945&action=edit
Code

cat case.c #230636
int b;
void foo();
void(a)();
int main() {
  int c;
  int *d = &c;
  *d = a && 8;
  b = 0;
  for (; b < 9; ++b)
    *d ^= 3;
  if (*d)
    ;
  else
    foo();
}

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

`gcc-e4faee8d02ec5d65bf418612f7181823eb08c078 (trunk) -Os -S -o /dev/stdout
case.c`
--------- OUTPUT ---------
main:
.LFB0:
        .cfi_startproc
        movl    $10, %edx
        xorl    %ecx, %ecx
        movl    $1, %eax
.L2:
        decl    %edx
        je      .L12
        xorl    $3, %eax
        movb    $1, %cl
        jmp     .L2
.L12:
        testb   %cl, %cl
        jne     .L4
        xorl    %esi, %esi
        movl    %esi, b(%rip)
        jmp     .L5
.L4:
        movl    $9, b(%rip)
.L5:
        testl   %eax, %eax
        jne     .L8
        pushq   %rdx
        .cfi_def_cfa_offset 16
        call    foo
        xorl    %eax, %eax
        popq    %rcx
        .cfi_def_cfa_offset 8
        ret
.L8:
        xorl    %eax, %eax
        ret
---------- END OUTPUT ---------


`gcc-releases/gcc-12.2.0 -Os -S -o /dev/stdout case.c`
--------- OUTPUT ---------
main:
.LFB0:
        .cfi_startproc
        movl    $9, b(%rip)
        xorl    %eax, %eax
        ret
---------- END OUTPUT ---------


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

             reply	other threads:[~2022-11-22 17:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-22 17:51 yann at ywg dot ch [this message]
2022-11-22 21:21 ` [Bug tree-optimization/107822] [13 Regression] " pinskia at gcc dot gnu.org
2022-12-21 13:48 ` rguenth at gcc dot gnu.org
2023-01-03 17:46 ` amacleod at redhat dot com
2023-02-27 10:15 ` rguenth at gcc dot gnu.org
2023-03-24  8:28 ` [Bug tree-optimization/107822] [13/14 " rguenth at gcc dot gnu.org
2023-03-27 20:47 ` amacleod at redhat dot com
2023-05-24 21:19 ` [Bug tree-optimization/107822] [13/14/14 " cvs-commit at gcc dot gnu.org
2023-08-09  4:27 ` pinskia 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-107822-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).