public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/105834] New: Dead Code Elimination Regression at -O2 (trunk vs. 12.1.0)
@ 2022-06-03 13:25 theodort at inf dot ethz.ch
  2022-06-13 12:36 ` [Bug tree-optimization/105834] [13 Regression] " rguenth at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: theodort at inf dot ethz.ch @ 2022-06-03 13:25 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 105834
           Summary: Dead Code Elimination Regression at -O2 (trunk vs.
                    12.1.0)
           Product: gcc
           Version: 13.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
static int a, b;

void foo();

int main() {
    for (int c = 0; c < 2; c = c + (unsigned)3)
        if (a)
            for (;;)
                if (c > 0)
                    b = 0;
    if (b)
        foo();
}

`gcc-1982fe2692b6c3b7f969ffc4edac59f9d4359e91 (trunk) -O2` can not eliminate
`foo` but `gcc-releases/gcc-12.1.0 -O2` can.

`gcc-1982fe2692b6c3b7f969ffc4edac59f9d4359e91 (trunk) -O2 -S -o /dev/stdout
case.c`
--------- OUTPUT ---------
main:
.LFB0:
        .cfi_startproc
        movl    b(%rip), %ecx
        testl   %ecx, %ecx
        jne     .L8
        xorl    %eax, %eax
        ret
.L8:
        pushq   %rax
        .cfi_def_cfa_offset 16
        xorl    %eax, %eax
        call    foo
        xorl    %eax, %eax
        popq    %rdx
        .cfi_def_cfa_offset 8
        ret
---------- END OUTPUT ---------


`gcc-releases/gcc-12.1.0 -O2 -S -o /dev/stdout case.c`
--------- OUTPUT ---------
main:
.LFB0:
        .cfi_startproc
        xorl    %eax, %eax
        ret
---------- END OUTPUT ---------


Bisects to:
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=98e475a8f58ca3ba6e9bd5c9276efce4236f5d26

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

* [Bug tree-optimization/105834] [13 Regression] Dead Code Elimination Regression at -O2 (trunk vs. 12.1.0)
  2022-06-03 13:25 [Bug tree-optimization/105834] New: Dead Code Elimination Regression at -O2 (trunk vs. 12.1.0) theodort at inf dot ethz.ch
@ 2022-06-13 12:36 ` rguenth at gcc dot gnu.org
  2023-02-21 14:23 ` rguenth at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-06-13 12:36 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Dead Code Elimination       |[13 Regression] Dead Code
                   |Regression at -O2 (trunk    |Elimination Regression at
                   |vs. 12.1.0)                 |-O2 (trunk vs. 12.1.0)
           Keywords|                            |missed-optimization
   Target Milestone|---                         |13.0

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

* [Bug tree-optimization/105834] [13 Regression] Dead Code Elimination Regression at -O2 (trunk vs. 12.1.0)
  2022-06-03 13:25 [Bug tree-optimization/105834] New: Dead Code Elimination Regression at -O2 (trunk vs. 12.1.0) theodort at inf dot ethz.ch
  2022-06-13 12:36 ` [Bug tree-optimization/105834] [13 Regression] " rguenth at gcc dot gnu.org
@ 2023-02-21 14:23 ` rguenth at gcc dot gnu.org
  2023-02-21 22:25 ` pinskia at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-02-21 14:23 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-02-21
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.  Not analyzed yet.

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

* [Bug tree-optimization/105834] [13 Regression] Dead Code Elimination Regression at -O2 (trunk vs. 12.1.0)
  2022-06-03 13:25 [Bug tree-optimization/105834] New: Dead Code Elimination Regression at -O2 (trunk vs. 12.1.0) theodort at inf dot ethz.ch
  2022-06-13 12:36 ` [Bug tree-optimization/105834] [13 Regression] " rguenth at gcc dot gnu.org
  2023-02-21 14:23 ` rguenth at gcc dot gnu.org
@ 2023-02-21 22:25 ` pinskia at gcc dot gnu.org
  2023-04-08 14:43 ` law at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-02-21 22:25 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
c_5  : int [0, 0][3, 3]
vs
c_5  : [irange] int [0, 3] NONZERO 0x3

Obvious the first range is more correct, c_5 can only be either 0 or 3.

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

* [Bug tree-optimization/105834] [13 Regression] Dead Code Elimination Regression at -O2 (trunk vs. 12.1.0)
  2022-06-03 13:25 [Bug tree-optimization/105834] New: Dead Code Elimination Regression at -O2 (trunk vs. 12.1.0) theodort at inf dot ethz.ch
                   ` (2 preceding siblings ...)
  2023-02-21 22:25 ` pinskia at gcc dot gnu.org
@ 2023-04-08 14:43 ` law at gcc dot gnu.org
  2023-04-26  6:56 ` [Bug tree-optimization/105834] [13/14 " rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: law at gcc dot gnu.org @ 2023-04-08 14:43 UTC (permalink / raw)
  To: gcc-bugs

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

Jeffrey A. Law <law at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2
                 CC|                            |law at gcc dot gnu.org

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

* [Bug tree-optimization/105834] [13/14 Regression] Dead Code Elimination Regression at -O2 (trunk vs. 12.1.0)
  2022-06-03 13:25 [Bug tree-optimization/105834] New: Dead Code Elimination Regression at -O2 (trunk vs. 12.1.0) theodort at inf dot ethz.ch
                   ` (3 preceding siblings ...)
  2023-04-08 14:43 ` law at gcc dot gnu.org
@ 2023-04-26  6:56 ` rguenth at gcc dot gnu.org
  2023-07-13 20:26 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-04-26  6:56 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 13.1 is being released, retargeting bugs to GCC 13.2.

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

* [Bug tree-optimization/105834] [13/14 Regression] Dead Code Elimination Regression at -O2 (trunk vs. 12.1.0)
  2022-06-03 13:25 [Bug tree-optimization/105834] New: Dead Code Elimination Regression at -O2 (trunk vs. 12.1.0) theodort at inf dot ethz.ch
                   ` (4 preceding siblings ...)
  2023-04-26  6:56 ` [Bug tree-optimization/105834] [13/14 " rguenth at gcc dot gnu.org
@ 2023-07-13 20:26 ` pinskia at gcc dot gnu.org
  2023-07-27  9:23 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-07-13 20:26 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |needs-bisection
      Known to work|                            |14.0

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Looks to be fixed on the trunk.

We also now get from evrp:
Global Exported: c_5 = [irange] int [0, 0][3, 3]

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

* [Bug tree-optimization/105834] [13/14 Regression] Dead Code Elimination Regression at -O2 (trunk vs. 12.1.0)
  2022-06-03 13:25 [Bug tree-optimization/105834] New: Dead Code Elimination Regression at -O2 (trunk vs. 12.1.0) theodort at inf dot ethz.ch
                   ` (5 preceding siblings ...)
  2023-07-13 20:26 ` pinskia at gcc dot gnu.org
@ 2023-07-27  9:23 ` rguenth at gcc dot gnu.org
  2023-11-05 22:05 ` tkoenig at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-27  9:23 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|13.2                        |13.3

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 13.2 is being released, retargeting bugs to GCC 13.3.

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

* [Bug tree-optimization/105834] [13/14 Regression] Dead Code Elimination Regression at -O2 (trunk vs. 12.1.0)
  2022-06-03 13:25 [Bug tree-optimization/105834] New: Dead Code Elimination Regression at -O2 (trunk vs. 12.1.0) theodort at inf dot ethz.ch
                   ` (6 preceding siblings ...)
  2023-07-27  9:23 ` rguenth at gcc dot gnu.org
@ 2023-11-05 22:05 ` tkoenig at gcc dot gnu.org
  2023-11-07  8:26 ` [Bug tree-optimization/105834] [13 " rguenth at gcc dot gnu.org
  2024-05-21  9:11 ` jakub at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2023-11-05 22:05 UTC (permalink / raw)
  To: gcc-bugs

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

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=109695
           Keywords|needs-bisection             |

--- Comment #6 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
On trunk, this was fixed by r14-1163-gd8b058d3ca4ebb, one of the
patchset which fixed PR 109695:

d8b058d3ca4ebbef5575105164417f125696f5ce is the first new commit
commit d8b058d3ca4ebbef5575105164417f125696f5ce
Author: Andrew MacLeod <amacleod@redhat.com>
Date:   Tue May 23 15:11:44 2023 -0400

    Choose better initial values for ranger.

    Instead of defaulting to VARYING, fold the stmt using just global ranges.

            PR tree-optimization/109695
            * gimple-range-cache.cc (ranger_cache::get_global_range): Call
            fold_range with global query to choose an initial value.

 gcc/gimple-range-cache.cc | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

Would this patch be something that could reasonably be backported?

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

* [Bug tree-optimization/105834] [13 Regression] Dead Code Elimination Regression at -O2 (trunk vs. 12.1.0)
  2022-06-03 13:25 [Bug tree-optimization/105834] New: Dead Code Elimination Regression at -O2 (trunk vs. 12.1.0) theodort at inf dot ethz.ch
                   ` (7 preceding siblings ...)
  2023-11-05 22:05 ` tkoenig at gcc dot gnu.org
@ 2023-11-07  8:26 ` rguenth at gcc dot gnu.org
  2024-05-21  9:11 ` jakub at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-11-07  8:26 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=110540

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
Note this change seems to have caused PR110540, so backporting would cause the
regression on the branch as well, sth. we'd want to avoid at this stage.

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

* [Bug tree-optimization/105834] [13 Regression] Dead Code Elimination Regression at -O2 (trunk vs. 12.1.0)
  2022-06-03 13:25 [Bug tree-optimization/105834] New: Dead Code Elimination Regression at -O2 (trunk vs. 12.1.0) theodort at inf dot ethz.ch
                   ` (8 preceding siblings ...)
  2023-11-07  8:26 ` [Bug tree-optimization/105834] [13 " rguenth at gcc dot gnu.org
@ 2024-05-21  9:11 ` jakub at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-05-21  9:11 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|13.3                        |13.4

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 13.3 is being released, retargeting bugs to GCC 13.4.

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

end of thread, other threads:[~2024-05-21  9:11 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-03 13:25 [Bug tree-optimization/105834] New: Dead Code Elimination Regression at -O2 (trunk vs. 12.1.0) theodort at inf dot ethz.ch
2022-06-13 12:36 ` [Bug tree-optimization/105834] [13 Regression] " rguenth at gcc dot gnu.org
2023-02-21 14:23 ` rguenth at gcc dot gnu.org
2023-02-21 22:25 ` pinskia at gcc dot gnu.org
2023-04-08 14:43 ` law at gcc dot gnu.org
2023-04-26  6:56 ` [Bug tree-optimization/105834] [13/14 " rguenth at gcc dot gnu.org
2023-07-13 20:26 ` pinskia at gcc dot gnu.org
2023-07-27  9:23 ` rguenth at gcc dot gnu.org
2023-11-05 22:05 ` tkoenig at gcc dot gnu.org
2023-11-07  8:26 ` [Bug tree-optimization/105834] [13 " rguenth at gcc dot gnu.org
2024-05-21  9:11 ` jakub 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).