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

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

            Bug ID: 110941
           Summary: [14 Regression] Dead Code Elimination Regression at
                    -O3 since r14-2379-gc496d15954c
           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 a;
void foo(void);
void bar349_(void);
void bar363_(void);
void bar275_(void);
int main() {
  {
    {
      short b = 26;
      for (; b >= 1; b = b - 4) {
        if (b >= 2 && b <= 26)
          bar275_();
        if (a)
          bar363_();
        if (a)
          bar349_();
        int c = b;
        if (!(c >= 2 && c <= 26))
          foo();
      }
    }
    a = 0;
  }
}

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:
.LFB0:
        .cfi_startproc
        pushq   %rbx
        .cfi_def_cfa_offset 16
        .cfi_offset 3, -16
        movl    $24, %ebx
        .p2align 4,,10
        .p2align 3
.L8:
        cmpw    $24, %bx
        jbe     .L2
        movl    a(%rip), %edx
        testl   %edx, %edx
        jne     .L3
.L7:
        call    foo
        xorl    %eax, %eax
        popq    %rbx
        .cfi_remember_state
        .cfi_def_cfa_offset 8
        movl    $0, a(%rip)
        ret
        .p2align 4,,10
        .p2align 3
.L3:
        .cfi_restore_state
        call    bar363_
        movl    a(%rip), %eax
        testl   %eax, %eax
        je      .L7
        call    bar349_
        jmp     .L7
.L2:
        call    bar275_
        cmpl    $0, a(%rip)
        jne     .L15
        .p2align 4,,10
        .p2align 3
.L6:
        subl    $4, %ebx
        cmpl    $-4, %ebx
        jne     .L8
        movl    $0, a(%rip)
        xorl    %eax, %eax
        popq    %rbx
        .cfi_remember_state
        .cfi_def_cfa_offset 8
        ret
.L15:
        .cfi_restore_state
        call    bar363_
        cmpl    $0, a(%rip)
        je      .L6
        call    bar349_
        cmpl    $24, %ebx
        jbe     .L6
        jmp     .L7
---------- END OUTPUT ---------

-----------------------------------------------------------------------
gcc-2b98cc24d6af0432a74f6dad1c722ce21c1f7458 -O3 case.c -S -o case.s
--------- OUTPUT ---------
main:
.LFB0:
        .cfi_startproc
        pushq   %rbx
        .cfi_def_cfa_offset 16
        .cfi_offset 3, -16
        movl    $24, %ebx
.L10:
        cmpw    $24, %bx
        jbe     .L2
        movl    a(%rip), %edx
        testl   %edx, %edx
        jne     .L17
.L3:
        movl    $0, a(%rip)
        xorl    %eax, %eax
        popq    %rbx
        .cfi_remember_state
        .cfi_def_cfa_offset 8
        ret
        .p2align 4,,10
        .p2align 3
.L17:
        .cfi_restore_state
        call    bar363_
        movl    a(%rip), %eax
        testl   %eax, %eax
        jne     .L4
.L15:
        subl    $4, %ebx
        jmp     .L10
        .p2align 4,,10
        .p2align 3
.L4:
        call    bar349_
        jmp     .L15
.L2:
        call    bar275_
        cmpl    $0, a(%rip)
        jne     .L18
        .p2align 4,,10
        .p2align 3
.L9:
        subl    $4, %ebx
        cmpw    $-4, %bx
        jne     .L10
        jmp     .L3
.L18:
        call    bar363_
        cmpl    $0, a(%rip)
        je      .L9
        call    bar349_
        jmp     .L9
---------- END OUTPUT ---------

-----------------------------------------------------------------------
Bisects to r14-2379-gc496d15954c

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

end of thread, other threads:[~2024-01-13  4:41 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-08  9:11 [Bug tree-optimization/110941] New: [14 Regression] Dead Code Elimination Regression at -O3 since r14-2379-gc496d15954c scherrer.sv at gmail dot com
2023-08-08  9:51 ` [Bug tree-optimization/110941] " rguenth at gcc dot gnu.org
2023-08-08 16:35 ` pinskia at gcc dot gnu.org
2023-09-16  7:46 ` pinskia at gcc dot gnu.org
2023-11-24  4:28 ` pinskia at gcc dot gnu.org
2024-01-10 14:46 ` jamborm at gcc dot gnu.org
2024-01-11  1:08 ` pinskia at gcc dot gnu.org
2024-01-13  4:39 ` cvs-commit at gcc dot gnu.org
2024-01-13  4:41 ` 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).