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

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

            Bug ID: 107823
           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 53946
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53946&action=edit
Code

cat case.c #230633
int a;
void bar64_(void);
void foo();
int main() {
  char b = a = 6;
  for (; a; a = 0) {
    bar64_();
    b = 0;
  }
  if (b <= 0)
    ;
  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
        pushq   %rcx
        .cfi_def_cfa_offset 16
        movl    $6, %eax
        movb    $6, %dl
.L2:
        movl    %eax, a(%rip)
        testl   %eax, %eax
        je      .L10
        call    bar64_
        xorl    %eax, %eax
        xorl    %edx, %edx
        jmp     .L2
.L10:
        testb   %dl, %dl
        je      .L4
        call    foo
.L4:
        xorl    %eax, %eax
        popq    %rdx
        .cfi_def_cfa_offset 8
        ret
---------- END OUTPUT ---------


`gcc-releases/gcc-12.2.0 -Os -S -o /dev/stdout case.c`
--------- OUTPUT ---------
main:
.LFB0:
        .cfi_startproc
        pushq   %rax
        .cfi_def_cfa_offset 16
        movl    $6, a(%rip)
        call    bar64_
        xorl    %edx, %edx
        xorl    %eax, %eax
        movl    %edx, a(%rip)
        popq    %rcx
        .cfi_def_cfa_offset 8
        ret
---------- END OUTPUT ---------


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

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

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

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-22 17:59 [Bug tree-optimization/107823] 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/107823] [13 Regression] " pinskia at gcc dot gnu.org
2022-11-23  9:52 ` marxin at gcc dot gnu.org
2022-11-23 20:48 ` rguenth at gcc dot gnu.org
2022-11-24  9:58 ` rguenth at gcc dot gnu.org
2023-04-08 14:40 ` law at gcc dot gnu.org
2023-04-26  6:57 ` [Bug tree-optimization/107823] [13/14 " rguenth at gcc dot gnu.org
2023-07-27  9:24 ` rguenth at gcc dot gnu.org
2023-11-24  3:42 ` pinskia at gcc dot gnu.org
2024-01-10 17:55 ` [Bug tree-optimization/107823] [13/14 Regression] Dead Code Elimination Regression at -Os (trunk vs. 12.2.0) since r13-1934-g353fd1ec3df92f jamborm at gcc dot gnu.org
2024-01-11  0:44 ` pinskia at gcc dot gnu.org
2024-01-13  4:39 ` cvs-commit at gcc dot gnu.org
2024-01-13  4:40 ` 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).