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/103257] New: [12 Regression] Dead Code Elimination Regression at -O3 (trunk vs 11.2.0)
Date: Mon, 15 Nov 2021 18:21:24 +0000	[thread overview]
Message-ID: <bug-103257-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 103257
           Summary: [12 Regression] Dead Code Elimination Regression at
                    -O3 (trunk vs 11.2.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 case.c

void foo(void);
unsigned b, c;
static short a(short e, short f) { return e * f; }
int main() {
  if (a(1  ^ ((0, 0) ^ 1 && b) <= b, c))
    foo();
  c = 0;
}

11.2.0 at -O3 can eliminate the call to foo but trunk at -O3 cannot:

gcc11  case.c -S -O3 -o /dev/stdout
main:
.LFB1:
        .cfi_startproc
        movl    b(%rip), %eax
        xorl    %edx, %edx
        testl   %eax, %eax
        setne   %dl
        cmpl    %edx, %eax
        movl    $0, %eax
        cmovb   c(%rip), %ax
        testw   %ax, %ax
        jne     .L11
        movl    $0, c(%rip)
        xorl    %eax, %eax
        ret
.L11:
        pushq   %rax
        .cfi_def_cfa_offset 16
        call    foo
        xorl    %edx, %edx
        xorl    %eax, %eax
        movl    %edx, c(%rip)
        popq    %rcx
        .cfi_def_cfa_offset 8
        ret
        .cfi_endproc


gcc-trunk -v
Target: x86_64-pc-linux-gnu
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.0.0 20211115 (experimental) (GCC)

It started with
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=0288527f47cec6698b31ccb3210816415506009e

             reply	other threads:[~2021-11-15 18:21 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-15 18:21 theodort at inf dot ethz.ch [this message]
2021-11-15 18:35 ` [Bug tree-optimization/103257] " aldyh at gcc dot gnu.org
2021-11-15 21:38 ` amacleod at redhat dot com
2021-11-16  0:40 ` pinskia at gcc dot gnu.org
2021-11-16  0:44 ` [Bug tree-optimization/103257] [9/10/11/12 " pinskia at gcc dot gnu.org
2021-11-16  0:48 ` pinskia at gcc dot gnu.org
2021-11-16  1:01 ` pinskia at gcc dot gnu.org
2021-11-16  4:52 ` pinskia at gcc dot gnu.org
2021-11-16  9:35 ` rguenth at gcc dot gnu.org
2021-11-17  8:02 ` pinskia at gcc dot gnu.org
2021-11-19  6:41 ` cvs-commit at gcc dot gnu.org
2021-11-19  6:43 ` 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-103257-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).