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/108368] New: [13 Regression] Dead Code Elimination Regression at -O3 since r13-1759-gdbb093f4f15
Date: Wed, 11 Jan 2023 13:16:01 +0000	[thread overview]
Message-ID: <bug-108368-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 108368
           Summary: [13 Regression] Dead Code Elimination Regression at
                    -O3 since r13-1759-gdbb093f4f15
           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 54244
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54244&action=edit
Case file

cat case.c #1409
int a;
int b;
short c;
static int d = 4;
void foo();
void e(int f) {}
int main() {
  unsigned g = -27;
  for (; g > 7; ++g) {
    e(c && g);
    b ? 0 : a;
    if (g) {
      if (0 >= d)
        foo();
    } else
      d = 0;
  }
}

`gcc-f99d7d669eaa2830eb5878df4da67e77ec791522 (trunk) -O3` can not eliminate
`foo` but `gcc-releases/gcc-12.2.0 -O3` can.

`gcc-f99d7d669eaa2830eb5878df4da67e77ec791522 (trunk) -O3 -S -o /dev/stdout
case.c`
--------- OUTPUT ---------
main:
.LFB1:
        .cfi_startproc
        pushq   %rbx
        .cfi_def_cfa_offset 16
        .cfi_offset 3, -16
        movl    $27, %ebx
.L5:
        movl    d(%rip), %eax
        testl   %eax, %eax
        jle     .L8
.L4:
        xorl    %eax, %eax
        popq    %rbx
        .cfi_remember_state
        .cfi_def_cfa_offset 8
        ret
        .p2align 4,,10
        .p2align 3
.L8:
        .cfi_restore_state
        xorl    %eax, %eax
        call    foo
        subl    $1, %ebx
        jne     .L5
        jmp     .L4
---------- END OUTPUT ---------


`gcc-releases/gcc-12.2.0 -O3 -S -o /dev/stdout case.c`
--------- OUTPUT ---------
main:
.LFB1:
        .cfi_startproc
        xorl    %eax, %eax
        ret
---------- END OUTPUT ---------


Bisects to: r13-1759-gdbb093f4f15

commit dbb093f4f15ea66f2ce5cd2dc1903a6894563356
Author: Andrew MacLeod <amacleod@redhat.com>
Date:   Mon Jul 18 15:04:23 2022 -0400

    Resolve complicated join nodes in range_from_dom.

    Join nodes which carry outgoing ranges on incoming edges are uncommon,
    but can still be resolved by setting the dominator range, and then
    calculating incoming edges.  Avoid doing so if one of the incoing edges
    is not dominated by the same dominator.

            * gimple-range-cache.cc (ranger_cache::range_from_dom): Check
              for incoming ranges on join nodes and add to worklist.

             reply	other threads:[~2023-01-11 13:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-11 13:16 yann at ywg dot ch [this message]
2023-01-11 13:55 ` [Bug tree-optimization/108368] " rguenth at gcc dot gnu.org
2023-01-13 21:01 ` amacleod at redhat dot com
2023-02-21 13:14 ` rguenth 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-108368-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).