public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/108368] New: [13 Regression] Dead Code Elimination Regression at -O3 since r13-1759-gdbb093f4f15
@ 2023-01-11 13:16 yann at ywg dot ch
  2023-01-11 13:55 ` [Bug tree-optimization/108368] " rguenth at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: yann at ywg dot ch @ 2023-01-11 13:16 UTC (permalink / raw)
  To: gcc-bugs

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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-02-21 13:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-11 13:16 [Bug tree-optimization/108368] New: [13 Regression] Dead Code Elimination Regression at -O3 since r13-1759-gdbb093f4f15 yann at ywg dot ch
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

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