public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/107822] New: Dead Code Elimination Regression at -Os (trunk vs. 12.2.0)
@ 2022-11-22 17:51 yann at ywg dot ch
  2022-11-22 21:21 ` [Bug tree-optimization/107822] [13 Regression] " pinskia at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: yann at ywg dot ch @ 2022-11-22 17:51 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 107822
           Summary: Dead Code Elimination Regression at -Os (trunk vs.
                    12.2.0)
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: yann at ywg dot ch
  Target Milestone: ---

Created attachment 53945
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53945&action=edit
Code

cat case.c #230636
int b;
void foo();
void(a)();
int main() {
  int c;
  int *d = &c;
  *d = a && 8;
  b = 0;
  for (; b < 9; ++b)
    *d ^= 3;
  if (*d)
    ;
  else
    foo();
}

`gcc-e4faee8d02ec5d65bf418612f7181823eb08c078 (trunk) -Os` can not eliminate
`foo` but `gcc-releases/gcc-12.2.0 -Os` can.

`gcc-e4faee8d02ec5d65bf418612f7181823eb08c078 (trunk) -Os -S -o /dev/stdout
case.c`
--------- OUTPUT ---------
main:
.LFB0:
        .cfi_startproc
        movl    $10, %edx
        xorl    %ecx, %ecx
        movl    $1, %eax
.L2:
        decl    %edx
        je      .L12
        xorl    $3, %eax
        movb    $1, %cl
        jmp     .L2
.L12:
        testb   %cl, %cl
        jne     .L4
        xorl    %esi, %esi
        movl    %esi, b(%rip)
        jmp     .L5
.L4:
        movl    $9, b(%rip)
.L5:
        testl   %eax, %eax
        jne     .L8
        pushq   %rdx
        .cfi_def_cfa_offset 16
        call    foo
        xorl    %eax, %eax
        popq    %rcx
        .cfi_def_cfa_offset 8
        ret
.L8:
        xorl    %eax, %eax
        ret
---------- END OUTPUT ---------


`gcc-releases/gcc-12.2.0 -Os -S -o /dev/stdout case.c`
--------- OUTPUT ---------
main:
.LFB0:
        .cfi_startproc
        movl    $9, b(%rip)
        xorl    %eax, %eax
        ret
---------- END OUTPUT ---------


Bisects to:
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=e7310e24b1c0ca67b1bb507c1330b2bf39e59e32

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

end of thread, other threads:[~2023-08-09  4:27 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-22 17:51 [Bug tree-optimization/107822] New: Dead Code Elimination Regression at -Os (trunk vs. 12.2.0) yann at ywg dot ch
2022-11-22 21:21 ` [Bug tree-optimization/107822] [13 Regression] " pinskia at gcc dot gnu.org
2022-12-21 13:48 ` rguenth at gcc dot gnu.org
2023-01-03 17:46 ` amacleod at redhat dot com
2023-02-27 10:15 ` rguenth at gcc dot gnu.org
2023-03-24  8:28 ` [Bug tree-optimization/107822] [13/14 " rguenth at gcc dot gnu.org
2023-03-27 20:47 ` amacleod at redhat dot com
2023-05-24 21:19 ` [Bug tree-optimization/107822] [13/14/14 " cvs-commit at gcc dot gnu.org
2023-08-09  4:27 ` 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).