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

* [Bug tree-optimization/108368] [13 Regression] Dead Code Elimination Regression at -O3 since r13-1759-gdbb093f4f15
  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 ` 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
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-01-11 13:55 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |13.0

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
range_from_dom looks expensive as well and the bb vs. prev_bb in walking
immediate dominators is quite confusing (not to speak about resolve_dom ...).

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

* [Bug tree-optimization/108368] [13 Regression] Dead Code Elimination Regression at -O3 since r13-1759-gdbb093f4f15
  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
  2 siblings, 0 replies; 4+ messages in thread
From: amacleod at redhat dot com @ 2023-01-13 21:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Macleod <amacleod at redhat dot com> ---
Not sure why it looks expensive, it is a lot cheaper than the original cache
propagation was, but still gets all the cases.

Regardless, the upcoming fix for 108356 fixes this PR as well.

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

* [Bug tree-optimization/108368] [13 Regression] Dead Code Elimination Regression at -O3 since r13-1759-gdbb093f4f15
  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
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-02-21 13:14 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
It's fixed on trunk now.

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