public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/110918] New: [14 Regression] Dead Code Elimination Regression at -O3 since r14-2331-g018e7f16408
@ 2023-08-06 10:58 scherrer.sv at gmail dot com
  2023-08-06 16:48 ` [Bug tree-optimization/110918] " pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: scherrer.sv at gmail dot com @ 2023-08-06 10:58 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 110918
           Summary: [14 Regression] Dead Code Elimination Regression at
                    -O3 since r14-2331-g018e7f16408
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: scherrer.sv at gmail dot com
  Target Milestone: ---

static char b = 53;
static unsigned c;
void foo(void);
static int(a)(int d, int e) { return (d ^ e) < 0 ? d : d - e; }
int main() {
  {
    int f = 2;
    c = b;
    b = 0;
    for (; c <= 6;) {
      if (f >= 2)
        f = 0;
      for (; f >= -9; f = a(f, 8))
        if (!(f >= -8 && f <= 0))
          foo();
    }
  }
}

gcc-87b0749cfb9 (trunk) -O3 cannot eliminate the call to foo but
gcc-releases/gcc-13.1.0 -O3 can.
-----------------------------------------------------------------------
gcc-87b0749cfb9406790b108208b466cf507ae3c431 -O3 case.c -S -o case.s
--------- OUTPUT ---------
main:
.LFB1:
        .cfi_startproc
        movsbl  b(%rip), %eax
        pushq   %rbx
        .cfi_def_cfa_offset 16
        .cfi_offset 3, -16
        xorl    %ebx, %ebx
        movb    $0, b(%rip)
        movl    %eax, c(%rip)
        cmpl    $6, %eax
        ja      .L11
        .p2align 4,,10
        .p2align 3
.L2:
        leal    8(%rbx), %eax
        cmpl    $8, %eax
        ja      .L16
.L3:
        cmpl    $-8, %ebx
        je      .L5
        cmpl    $-1, %ebx
        jl      .L6
        movl    $-8, %ebx
        leal    8(%rbx), %eax
        cmpl    $8, %eax
        jbe     .L3
.L16:
        call    foo
        subl    $8, %ebx
        jmp     .L2
.L5:
        jmp     .L5
        .p2align 4,,10
        .p2align 3
.L6:
        cmpl    $6, c(%rip)
        ja      .L11
.L8:
        jmp     .L8
        .p2align 4,,10
        .p2align 3
.L11:
        xorl    %eax, %eax
        popq    %rbx
        .cfi_def_cfa_offset 8
        ret
---------- END OUTPUT ---------

-----------------------------------------------------------------------
gcc-2b98cc24d6af0432a74f6dad1c722ce21c1f7458 -O3 case.c -S -o case.s
--------- OUTPUT ---------
main:
.LFB1:
        .cfi_startproc
        movsbl  b(%rip), %edx
        xorl    %eax, %eax
        movb    $0, b(%rip)
        movl    %edx, c(%rip)
        cmpl    $6, %edx
        ja      .L8
        .p2align 4,,10
        .p2align 3
.L2:
        testl   %eax, %eax
        js      .L3
        subl    $8, %eax
        cmpl    $-9, %eax
        jge     .L2
        cmpl    $6, c(%rip)
        ja      .L8
.L6:
        jmp     .L6
.L3:
        jmp     .L3
        .p2align 4,,10
        .p2align 3
.L8:
        xorl    %eax, %eax
        ret
---------- END OUTPUT ---------

-----------------------------------------------------------------------
Bisects to r14-2331-g018e7f16408

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

* [Bug tree-optimization/110918] [14 Regression] Dead Code Elimination Regression at -O3 since r14-2331-g018e7f16408
  2023-08-06 10:58 [Bug tree-optimization/110918] New: [14 Regression] Dead Code Elimination Regression at -O3 since r14-2331-g018e7f16408 scherrer.sv at gmail dot com
@ 2023-08-06 16:48 ` pinskia at gcc dot gnu.org
  2023-08-20  8:55 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-08-06 16:48 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |14.0

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

* [Bug tree-optimization/110918] [14 Regression] Dead Code Elimination Regression at -O3 since r14-2331-g018e7f16408
  2023-08-06 10:58 [Bug tree-optimization/110918] New: [14 Regression] Dead Code Elimination Regression at -O3 since r14-2331-g018e7f16408 scherrer.sv at gmail dot com
  2023-08-06 16:48 ` [Bug tree-optimization/110918] " pinskia at gcc dot gnu.org
@ 2023-08-20  8:55 ` pinskia at gcc dot gnu.org
  2023-08-23 18:47 ` cvs-commit at gcc dot gnu.org
  2023-08-23 21:43 ` amacleod at redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-08-20  8:55 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.
The first change in IR is threadfull2 and then VRP2 is not able to remove the
call to foo.

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

* [Bug tree-optimization/110918] [14 Regression] Dead Code Elimination Regression at -O3 since r14-2331-g018e7f16408
  2023-08-06 10:58 [Bug tree-optimization/110918] New: [14 Regression] Dead Code Elimination Regression at -O3 since r14-2331-g018e7f16408 scherrer.sv at gmail dot com
  2023-08-06 16:48 ` [Bug tree-optimization/110918] " pinskia at gcc dot gnu.org
  2023-08-20  8:55 ` pinskia at gcc dot gnu.org
@ 2023-08-23 18:47 ` cvs-commit at gcc dot gnu.org
  2023-08-23 21:43 ` amacleod at redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-08-23 18:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Andrew Macleod <amacleod@gcc.gnu.org>:

https://gcc.gnu.org/g:0cfc9c953d0221ec3971a25e6509ebe1041f142e

commit r14-3414-g0cfc9c953d0221ec3971a25e6509ebe1041f142e
Author: Andrew MacLeod <amacleod@redhat.com>
Date:   Thu Aug 17 12:34:59 2023 -0400

    Phi analyzer - Initialize with range instead of a tree.

    Rangers PHI analyzer currently only allows a single initializer to a group.
    This patch changes that to use an inialization range, which is
    cumulative of all integer constants, plus a single symbolic value.
    There is no other change to group functionality.

    This patch also changes the way PHI groups are printed so they show up in
the
    listing as they are encountered, rather than as a list at the end.  It
    was more difficult to see what was going on previously.

            PR tree-optimization/110918 - Initialize with range instead of a
tree.
            gcc/
            * gimple-range-fold.cc (fold_using_range::range_of_phi): Tweak
output.
            * gimple-range-phi.cc (phi_group::phi_group): Remove unused
members.
            Initialize using a range instead of value and edge.
            (phi_group::calculate_using_modifier): Use initializer value and
            process for relations after trying for iteration convergence.
            (phi_group::refine_using_relation): Use initializer range.
            (phi_group::dump): Rework the dump output.
            (phi_analyzer::process_phi): Allow multiple constant initilizers.
            Dump groups immediately as created.
            (phi_analyzer::dump): Tweak output.
            * gimple-range-phi.h (phi_group::phi_group): Adjust prototype.
            (phi_group::initial_value): Delete.
            (phi_group::refine_using_relation): Adjust prototype.
            (phi_group::m_initial_value): Delete.
            (phi_group::m_initial_edge): Delete.
            (phi_group::m_vr): Use int_range_max.
            * tree-vrp.cc (execute_ranger_vrp): Don't dump phi groups.

            gcc/testsuite/
            * gcc.dg/pr102983.c: Adjust output expectations.
            * gcc.dg/pr110918.c: New.

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

* [Bug tree-optimization/110918] [14 Regression] Dead Code Elimination Regression at -O3 since r14-2331-g018e7f16408
  2023-08-06 10:58 [Bug tree-optimization/110918] New: [14 Regression] Dead Code Elimination Regression at -O3 since r14-2331-g018e7f16408 scherrer.sv at gmail dot com
                   ` (2 preceding siblings ...)
  2023-08-23 18:47 ` cvs-commit at gcc dot gnu.org
@ 2023-08-23 21:43 ` amacleod at redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: amacleod at redhat dot com @ 2023-08-23 21:43 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Macleod <amacleod at redhat dot com> changed:

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

--- Comment #3 from Andrew Macleod <amacleod at redhat dot com> ---
fixed.

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

end of thread, other threads:[~2023-08-23 21:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-06 10:58 [Bug tree-optimization/110918] New: [14 Regression] Dead Code Elimination Regression at -O3 since r14-2331-g018e7f16408 scherrer.sv at gmail dot com
2023-08-06 16:48 ` [Bug tree-optimization/110918] " pinskia at gcc dot gnu.org
2023-08-20  8:55 ` pinskia at gcc dot gnu.org
2023-08-23 18:47 ` cvs-commit at gcc dot gnu.org
2023-08-23 21:43 ` amacleod at redhat dot com

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