public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/110942] New: [14 Regression] Dead Code Elimination Regression at -O3 since r14-1165-g257c2be7ff8
@ 2023-08-08  9:24 scherrer.sv at gmail dot com
  2023-08-08  9:51 ` [Bug tree-optimization/110942] " rguenth at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: scherrer.sv at gmail dot com @ 2023-08-08  9:24 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 110942
           Summary: [14 Regression] Dead Code Elimination Regression at
                    -O3 since r14-1165-g257c2be7ff8
           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;
static short d;
static char e;
void bar49_(void);
void bar115_(void);
void bar42_(void);
void foo(void);
static short(a)(short f, short g) { return f + g; }
static int h() {
  short i = 0;
  char j;
  int k;
l:
  k = 0;
  if (i)
    bar42_();
  i = 0;
  for (; i != 8; i = a(i, 8)) {
    if (e)
      bar49_();
    if (0 >= i)
      c = 0;
    if (!k) {
      j = 6;
      for (; j >= 0; j--) {
        k = 0;
        for (; k <= 0; k++) {
          if (!(j >= 5))
            bar115_();
          for (; d; d = 0) {
            if (!j)
              foo();
            if (j)
              break;
          }
          if (i)
            break;
        }
        if (c)
          return j;
        c = 2;
        if (b)
          goto l;
      }
    }
  }
  return 0;
}
int main() { h(); }

gcc-25c4b1620eb (trunk) -O3 cannot eliminate the call to foo but
gcc-releases/gcc-13.1.0 -O3 can.
-----------------------------------------------------------------------
gcc-25c4b1620ebc10fceabd86a34fdbbaf8037e7e82 -O3 case.c -S -o case.s
--------- OUTPUT ---------
main:
.LFB2:
        .cfi_startproc
        pushq   %rbx
        .cfi_def_cfa_offset 16
        .cfi_offset 3, -16
        xorl    %eax, %eax
        movl    $6, %ebx
.L2:
        movl    %eax, c(%rip)
        cmpb    $4, %bl
        jne     .L18
.L7:
        call    bar115_
        cmpw    $0, d(%rip)
        je      .L8
        testb   %bl, %bl
        jne     .L8
        call    foo
        movl    c(%rip), %edx
        xorl    %eax, %eax
        movw    %ax, d(%rip)
        testl   %edx, %edx
        jne     .L5
        movl    $2, c(%rip)
.L5:
        xorl    %eax, %eax
        popq    %rbx
        .cfi_remember_state
        .cfi_def_cfa_offset 8
        ret
.L18:
        .cfi_restore_state
        testl   %eax, %eax
        jne     .L5
        subl    $1, %ebx
        movl    $2, %eax
        jmp     .L2
.L8:
        cmpl    $0, c(%rip)
        jne     .L5
        movl    $2, c(%rip)
        subl    $1, %ebx
        cmpb    $-1, %bl
        jne     .L7
        jmp     .L5
---------- END OUTPUT ---------

-----------------------------------------------------------------------
gcc-2b98cc24d6af0432a74f6dad1c722ce21c1f7458 -O3 case.c -S -o case.s
--------- OUTPUT ---------
main:
.LFB2:
        .cfi_startproc
        movl    $2, c(%rip)
        xorl    %eax, %eax
        ret
---------- END OUTPUT ---------

-----------------------------------------------------------------------
Bisects to r14-1165-g257c2be7ff8

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

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

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-08  9:24 [Bug tree-optimization/110942] New: [14 Regression] Dead Code Elimination Regression at -O3 since r14-1165-g257c2be7ff8 scherrer.sv at gmail dot com
2023-08-08  9:51 ` [Bug tree-optimization/110942] " rguenth at gcc dot gnu.org
2023-08-16 19:20 ` amacleod at redhat dot com
2023-08-16 19:34 ` pinskia at gcc dot gnu.org
2023-08-16 20:04 ` amacleod at redhat dot com
2023-11-24  4:31 ` pinskia at gcc dot gnu.org
2024-01-10 14:44 ` jamborm at gcc dot gnu.org
2024-03-04  4:50 ` 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).