public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/111013] New: [14 Regression] Dead Code Elimination Regression at -O2 since r14-338-g1dd154f6407
@ 2023-08-14 12:47 scherrer.sv at gmail dot com
  2023-08-14 14:04 ` [Bug tree-optimization/111013] " rguenth 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-14 12:47 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 111013
           Summary: [14 Regression] Dead Code Elimination Regression at
                    -O2 since r14-338-g1dd154f6407
           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 int b, c, e;
static unsigned d;
static short f;
void foo(void);
void(a)();
static char g(int h) {
  int i = 2749857453;
j:
  a();
k:
  if (b)
    goto j;
  f = 1;
  if ((unsigned)(7 ^ e | (h & d && f)) >= 2)
    i = 0;
  e = 0;
  if (c)
    goto k;
  if (!(i <= 6))
    foo();
  return h;
}
int main() {
  d--;
  b = c = e && g(1);
}

gcc-9ec5d6de735 (trunk) -O2 cannot eliminate the call to foo but
gcc-releases/gcc-13.1.0 -O2 can.
-----------------------------------------------------------------------
gcc-9ec5d6de7355c15b3811150d1581dab5bd489966 -O2 case.c -S -o case.s
--------- OUTPUT ---------
main:
.LFB1:
        .cfi_startproc
        subq    $8, %rsp
        .cfi_def_cfa_offset 16
        movl    e(%rip), %eax
        subl    $1, d(%rip)
        testl   %eax, %eax
        jne     .L3
.L2:
        movl    %eax, c(%rip)
        movl    %eax, b(%rip)
        xorl    %eax, %eax
        addq    $8, %rsp
        .cfi_remember_state
        .cfi_def_cfa_offset 8
        ret
        .p2align 4,,10
        .p2align 3
.L3:
        .cfi_restore_state
        xorl    %eax, %eax
        call    a
        movl    b(%rip), %edx
        testl   %edx, %edx
        jne     .L3
        movl    d(%rip), %ecx
        movl    e(%rip), %eax
        movl    $-1545109843, %edx
        xorl    %esi, %esi
        movl    c(%rip), %edi
        andl    $1, %ecx
        jmp     .L5
        .p2align 4,,10
        .p2align 3
.L8:
        xorl    %eax, %eax
.L5:
        xorl    $7, %eax
        orl     %ecx, %eax
        cmpl    $2, %eax
        cmovnb  %esi, %edx
        testl   %edi, %edi
        jne     .L8
        xorl    %eax, %eax
        movl    %eax, e(%rip)
        cmpl    $6, %edx
        jg      .L15
.L6:
        movl    $1, %eax
        jmp     .L2
.L15:
        call    foo
        jmp     .L6
---------- END OUTPUT ---------

-----------------------------------------------------------------------
gcc-2b98cc24d6af0432a74f6dad1c722ce21c1f7458 -O2 case.c -S -o case.s
--------- OUTPUT ---------
main:
.LFB1:
        .cfi_startproc
        subq    $8, %rsp
        .cfi_def_cfa_offset 16
        movl    e(%rip), %eax
        subl    $1, d(%rip)
        testl   %eax, %eax
        jne     .L3
.L2:
        movl    %eax, c(%rip)
        movl    %eax, b(%rip)
        xorl    %eax, %eax
        addq    $8, %rsp
        .cfi_remember_state
        .cfi_def_cfa_offset 8
        ret
        .p2align 4,,10
        .p2align 3
.L3:
        .cfi_restore_state
        xorl    %eax, %eax
        call    a
        movl    b(%rip), %edx
        movl    c(%rip), %eax
        testl   %edx, %edx
        jne     .L3
        testl   %eax, %eax
        je      .L4
.L5:
        jmp     .L5
.L4:
        xorl    %eax, %eax
        movl    %eax, e(%rip)
        movl    $1, %eax
        jmp     .L2
---------- END OUTPUT ---------

-----------------------------------------------------------------------
Bisects to r14-338-g1dd154f6407

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

* [Bug tree-optimization/111013] [14 Regression] Dead Code Elimination Regression at -O2 since r14-338-g1dd154f6407
  2023-08-14 12:47 [Bug tree-optimization/111013] New: [14 Regression] Dead Code Elimination Regression at -O2 since r14-338-g1dd154f6407 scherrer.sv at gmail dot com
@ 2023-08-14 14:04 ` rguenth at gcc dot gnu.org
  2023-08-14 15:20 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-08-14 14:04 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu.org
   Target Milestone|---                         |14.0

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

* [Bug tree-optimization/111013] [14 Regression] Dead Code Elimination Regression at -O2 since r14-338-g1dd154f6407
  2023-08-14 12:47 [Bug tree-optimization/111013] New: [14 Regression] Dead Code Elimination Regression at -O2 since r14-338-g1dd154f6407 scherrer.sv at gmail dot com
  2023-08-14 14:04 ` [Bug tree-optimization/111013] " rguenth at gcc dot gnu.org
@ 2023-08-14 15:20 ` pinskia at gcc dot gnu.org
  2023-08-14 15:31 ` pinskia at gcc dot gnu.org
  2023-08-25 19:07 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-08-14 15:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
THe only difference phiopt does is:
GCC 13:
```
  _19 = d.8_18 & 1;
  _6 = (bool) _19;
  _21 = (int) _6;
```

vs trunk:
```
  _19 = d.8_18 & 1;
  _33 = _19 != 0;
  _21 = (int) _33;
```

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

* [Bug tree-optimization/111013] [14 Regression] Dead Code Elimination Regression at -O2 since r14-338-g1dd154f6407
  2023-08-14 12:47 [Bug tree-optimization/111013] New: [14 Regression] Dead Code Elimination Regression at -O2 since r14-338-g1dd154f6407 scherrer.sv at gmail dot com
  2023-08-14 14:04 ` [Bug tree-optimization/111013] " rguenth at gcc dot gnu.org
  2023-08-14 15:20 ` pinskia at gcc dot gnu.org
@ 2023-08-14 15:31 ` pinskia at gcc dot gnu.org
  2023-08-25 19:07 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-08-14 15:31 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.

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

* [Bug tree-optimization/111013] [14 Regression] Dead Code Elimination Regression at -O2 since r14-338-g1dd154f6407
  2023-08-14 12:47 [Bug tree-optimization/111013] New: [14 Regression] Dead Code Elimination Regression at -O2 since r14-338-g1dd154f6407 scherrer.sv at gmail dot com
                   ` (2 preceding siblings ...)
  2023-08-14 15:31 ` pinskia at gcc dot gnu.org
@ 2023-08-25 19:07 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-08-25 19:07 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=110918
         Resolution|---                         |FIXED

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed by  r14-3414-g0cfc9c953d0221ec3971a25 .

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

end of thread, other threads:[~2023-08-25 19:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-14 12:47 [Bug tree-optimization/111013] New: [14 Regression] Dead Code Elimination Regression at -O2 since r14-338-g1dd154f6407 scherrer.sv at gmail dot com
2023-08-14 14:04 ` [Bug tree-optimization/111013] " rguenth at gcc dot gnu.org
2023-08-14 15:20 ` pinskia at gcc dot gnu.org
2023-08-14 15:31 ` pinskia at gcc dot gnu.org
2023-08-25 19:07 ` pinskia 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).