public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/110841] New: [14 Regression] Dead Code Elimination Regression since r14-2675-gef28aadad6e
@ 2023-07-28 10:10 theodort at inf dot ethz.ch
  2023-07-28 13:24 ` [Bug tree-optimization/110841] " rguenth at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: theodort at inf dot ethz.ch @ 2023-07-28 10:10 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 110841
           Summary: [14 Regression] Dead Code Elimination Regression since
                    r14-2675-gef28aadad6e
           Product: gcc
           Version: 14.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: ---

https://godbolt.org/z/YondMzhT8

Given the following code:

void foo(void);
static int b, c, d;
static char(a)(char e, char f) { return e - f; }
int main() {
    for (; b <= 4; b++)
        ;
    c = 0;
    for (; c >= -16; c = a(c, 4))
        ;
    char g = b;
    for (; d <= 0; d++) {
        if (!(((g) >= 5) && ((g) <= 5))) {
            __builtin_unreachable();
        }
        if (c) return 0;
        g = 0;
        for (;;) {
            foo();
            break;
        }
    }
}

gcc-trunk -O2 does not eliminate the call to foo:

main:
        cmpl    $4, b(%rip)
        jg      .L2
        movl    $5, b(%rip)
.L2:
        movl    $-20, c(%rip)
        movl    d(%rip), %ecx
        testl   %ecx, %ecx
        jg      .L10
        cmpl    $0, c(%rip)
        jne     .L10
        pushq   %rax
        jmp     .L11
        .p2align 4,,10
        .p2align 3
.L3:
        movl    c(%rip), %edx
        testl   %edx, %edx
        jne     .L5
.L11:
        call    foo
        movl    d(%rip), %eax
        addl    $1, %eax
        movl    %eax, d(%rip)
        testl   %eax, %eax
        jle     .L3
.L5:
        xorl    %eax, %eax
        addq    $8, %rsp
        ret
.L10:
        xorl    %eax, %eax
        ret

gcc-13.2.0 -O2 eliminates the call to foo:

main:
        cmpl    $4, b(%rip)
        jg      .L2
        movl    $5, b(%rip)
.L2:
        movl    $-20, c(%rip)
        xorl    %eax, %eax
        ret

Bisects to r14-2675-gef28aadad6e

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

* [Bug tree-optimization/110841] [14 Regression] Dead Code Elimination Regression since r14-2675-gef28aadad6e
  2023-07-28 10:10 [Bug tree-optimization/110841] New: [14 Regression] Dead Code Elimination Regression since r14-2675-gef28aadad6e theodort at inf dot ethz.ch
@ 2023-07-28 13:24 ` rguenth at gcc dot gnu.org
  2023-08-07  9:16 ` pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-28 13:24 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |14.0
           Keywords|                            |missed-optimization

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

* [Bug tree-optimization/110841] [14 Regression] Dead Code Elimination Regression since r14-2675-gef28aadad6e
  2023-07-28 10:10 [Bug tree-optimization/110841] New: [14 Regression] Dead Code Elimination Regression since r14-2675-gef28aadad6e theodort at inf dot ethz.ch
  2023-07-28 13:24 ` [Bug tree-optimization/110841] " rguenth at gcc dot gnu.org
@ 2023-08-07  9:16 ` pinskia at gcc dot gnu.org
  2023-11-24  4:09 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-08-07  9:16 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2023-08-07

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.
The change in loop ch causes a missing removing a redundant load from happening
which causes a missing jump threading which is able to remove the loop and the
call to foo.

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

* [Bug tree-optimization/110841] [14 Regression] Dead Code Elimination Regression since r14-2675-gef28aadad6e
  2023-07-28 10:10 [Bug tree-optimization/110841] New: [14 Regression] Dead Code Elimination Regression since r14-2675-gef28aadad6e theodort at inf dot ethz.ch
  2023-07-28 13:24 ` [Bug tree-optimization/110841] " rguenth at gcc dot gnu.org
  2023-08-07  9:16 ` pinskia at gcc dot gnu.org
@ 2023-11-24  4:09 ` pinskia at gcc dot gnu.org
  2024-01-10 14:18 ` jamborm at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-11-24  4:09 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |needs-bisection

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Looks to be fixed now.

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

* [Bug tree-optimization/110841] [14 Regression] Dead Code Elimination Regression since r14-2675-gef28aadad6e
  2023-07-28 10:10 [Bug tree-optimization/110841] New: [14 Regression] Dead Code Elimination Regression since r14-2675-gef28aadad6e theodort at inf dot ethz.ch
                   ` (2 preceding siblings ...)
  2023-11-24  4:09 ` pinskia at gcc dot gnu.org
@ 2024-01-10 14:18 ` jamborm at gcc dot gnu.org
  2024-01-11  1:12 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jamborm at gcc dot gnu.org @ 2024-01-10 14:18 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Jambor <jamborm at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|needs-bisection             |
                 CC|                            |jamborm at gcc dot gnu.org

--- Comment #3 from Martin Jambor <jamborm at gcc dot gnu.org> ---
The testcase has been fixed with r14-4141-gbf6b107e2a3423 (New early
__builtin_unreachable processing.)

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

* [Bug tree-optimization/110841] [14 Regression] Dead Code Elimination Regression since r14-2675-gef28aadad6e
  2023-07-28 10:10 [Bug tree-optimization/110841] New: [14 Regression] Dead Code Elimination Regression since r14-2675-gef28aadad6e theodort at inf dot ethz.ch
                   ` (3 preceding siblings ...)
  2024-01-10 14:18 ` jamborm at gcc dot gnu.org
@ 2024-01-11  1:12 ` pinskia at gcc dot gnu.org
  2024-01-13  4:39 ` cvs-commit at gcc dot gnu.org
  2024-03-04  4:52 ` law at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-01-11  1:12 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |pinskia at gcc dot gnu.org

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Will commit a testcase.

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

* [Bug tree-optimization/110841] [14 Regression] Dead Code Elimination Regression since r14-2675-gef28aadad6e
  2023-07-28 10:10 [Bug tree-optimization/110841] New: [14 Regression] Dead Code Elimination Regression since r14-2675-gef28aadad6e theodort at inf dot ethz.ch
                   ` (4 preceding siblings ...)
  2024-01-11  1:12 ` pinskia at gcc dot gnu.org
@ 2024-01-13  4:39 ` cvs-commit at gcc dot gnu.org
  2024-03-04  4:52 ` law at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-01-13  4:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrew Pinski <pinskia@gcc.gnu.org>:

https://gcc.gnu.org/g:34a827039fabcf24ce78da25984a1cc8be7ca2c3

commit r14-7221-g34a827039fabcf24ce78da25984a1cc8be7ca2c3
Author: Andrew Pinski <quic_apinski@quicinc.com>
Date:   Fri Jan 12 20:24:34 2024 -0800

    Add a few testcases for fix missed optimization regressions

    Adds a few new testcases for some missed optimization regressions.
    The analysis on how each should be optimized is in the testcases
    themselves (and in the bug report).

    Committed as obvious after running the testsuite to make sure they pass.

            PR tree-optimization/107823
            PR tree-optimization/110768
            PR tree-optimization/110941
            PR tree-optimization/110450
            PR tree-optimization/110841

    gcc/testsuite/ChangeLog:

            * gcc.dg/tree-ssa/ssa-thread-22.c: New test.
            * gcc.dg/tree-ssa/vrp-loop-1.c: New test.
            * gcc.dg/tree-ssa/vrp-loop-2.c: New test.
            * gcc.dg/tree-ssa/vrp-unreachable-1.c: New test.
            * gcc.dg/tree-ssa/vrp-unreachable-2.c: New test.

    Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>

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

* [Bug tree-optimization/110841] [14 Regression] Dead Code Elimination Regression since r14-2675-gef28aadad6e
  2023-07-28 10:10 [Bug tree-optimization/110841] New: [14 Regression] Dead Code Elimination Regression since r14-2675-gef28aadad6e theodort at inf dot ethz.ch
                   ` (5 preceding siblings ...)
  2024-01-13  4:39 ` cvs-commit at gcc dot gnu.org
@ 2024-03-04  4:52 ` law at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: law at gcc dot gnu.org @ 2024-03-04  4:52 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |law at gcc dot gnu.org
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #6 from Jeffrey A. Law <law at gcc dot gnu.org> ---
Per comment #2 and #3.

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

end of thread, other threads:[~2024-03-04  4:53 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-28 10:10 [Bug tree-optimization/110841] New: [14 Regression] Dead Code Elimination Regression since r14-2675-gef28aadad6e theodort at inf dot ethz.ch
2023-07-28 13:24 ` [Bug tree-optimization/110841] " rguenth at gcc dot gnu.org
2023-08-07  9:16 ` pinskia at gcc dot gnu.org
2023-11-24  4:09 ` pinskia at gcc dot gnu.org
2024-01-10 14:18 ` jamborm at gcc dot gnu.org
2024-01-11  1:12 ` pinskia at gcc dot gnu.org
2024-01-13  4:39 ` cvs-commit at gcc dot gnu.org
2024-03-04  4:52 ` law 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).