public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "theodort at inf dot ethz.ch" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/102950] New: [11 Regression] Dead Code Elimination Regression at -O3 (trunk&11.2.0 vs 10.3.0)
Date: Tue, 26 Oct 2021 15:21:16 +0000	[thread overview]
Message-ID: <bug-102950-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 102950
           Summary: [11 Regression] Dead Code Elimination Regression at
                    -O3 (trunk&11.2.0 vs 10.3.0)
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: theodort at inf dot ethz.ch
  Target Milestone: ---

cat test.c
void foo(void);

static char a;
static short d(unsigned e) {
  char b;
  short c;
  a = b = e;
  if (b)
    return 0;
  if (1 >= e) {
    c = e == 0;
    if (c)
      foo();
  }
  return 0;
}
int main() { d(a ^ 233); }

10.3.0 at -O3 can eliminate the call to foo but neither trunk nor 11.2.0 at -O3
can:

gcc-10 -O3 -S test.c -o /dev/stdout
main:
.LFB1:
        .cfi_startproc
        xorb    $-23, a(%rip)
        xorl    %eax, %eax
        ret
        .cfi_endproc

gcc-11 -O3 -S test.c -o /dev/stdout
...
main:
.LFB1:
        .cfi_startproc
        movsbl  a(%rip), %eax
        xorb    $-23, %al
        movb    %al, a(%rip)
        cmpl    $1, %eax
        ja      .L10
        testb   %al, %al
        je      .L14
.L10:
        xorl    %eax, %eax
        ret
.L14:
        pushq   %rax
        .cfi_def_cfa_offset 16
        call    foo
        xorl    %eax, %eax
        popq    %rdx
        .cfi_def_cfa_offset 8
        ret
        .cfi_endproc


gcc-trunk -O3 -S test.c -o /dev/stdout
main:
.LFB1:
        .cfi_startproc
        movsbl  a(%rip), %eax
        xorb    $-23, %al
        movb    %al, a(%rip)
        cmpl    $1, %eax
        ja      .L10
        testb   %al, %al
        je      .L14
.L10:
        xorl    %eax, %eax
        ret
.L14:
        pushq   %rax
        .cfi_def_cfa_offset 16
        call    foo
        xorl    %eax, %eax
        popq    %rdx
        .cfi_def_cfa_offset 8
        ret
        .cfi_endproc


gcc-trunk -v
Using built-in specs.
Target: x86_64-pc-linux-gnu
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.0.0 20211022 (experimental) (GCC)

Introduced with
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=fcae5121154d1c3382b056bcc2c563cedac28e74

             reply	other threads:[~2021-10-26 15:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-26 15:21 theodort at inf dot ethz.ch [this message]
2021-10-27  0:42 ` [Bug tree-optimization/102950] [11/12 " pinskia at gcc dot gnu.org
2021-10-27  2:49 ` hjl.tools at gmail dot com
2021-11-05 19:19 ` amacleod at redhat dot com
2022-01-18 14:38 ` rguenth at gcc dot gnu.org
2022-02-01  8:59 ` roger at nextmovesoftware dot com
2022-04-21  7:50 ` rguenth at gcc dot gnu.org
2022-05-03 18:45 ` [Bug tree-optimization/102950] [11/12/13 " cvs-commit at gcc dot gnu.org
2022-05-07 20:11 ` [Bug tree-optimization/102950] [11/12 Regression] Dead Code Elimination Regression at -O3 (11.2.0 " roger at nextmovesoftware dot com
2022-11-03 19:01 ` amacleod at redhat dot com

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