public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/108360] New: Dead Code Elimination Regression at -Os (trunk vs. 12.2.0)
@ 2023-01-10 13:10 yann at ywg dot ch
  2023-01-10 14:48 ` [Bug tree-optimization/108360] [13 Regression] Dead Code Elimination Regression at -Os since r13-2048-g418b71c0d535bf marxin at gcc dot gnu.org
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: yann at ywg dot ch @ 2023-01-10 13:10 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108360
           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 54235
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54235&action=edit
case.c as file

cat case.c #321
static short b, c;
unsigned char e;
char f;
void foo();
short(a)(short h, short i) { return h + i; }
static short(d)(short h, int i) { return h >= 32 || h > 7 >> i ? h : h << i; }
unsigned g(short h, short i) { return h + i; }
int main() {
  short j, k = -1;
  c = a(0 >= b, k);
  f = c <= 0xD315BEF1;
  e = f << 4;
  j = d(e, 5);
  if (3 >= g(j == b, k))
    foo();
  b = 0;
}

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

`gcc-cb93c5f8008b95743b741d6f1842f9be50c6985c (trunk) -Os -S -o /dev/stdout
case.c`
--------- OUTPUT ---------
main:
.LFB3:
        .cfi_startproc
        movw    b(%rip), %cx
        xorl    %edx, %edx
        testw   %cx, %cx
        setle   %dl
        movl    %edx, %eax
        movb    %dl, f(%rip)
        sall    $4, %eax
        movb    %al, e(%rip)
        movzbl  %al, %eax
        testw   %dx, %dx
        jne     .L4
        sall    $5, %eax
.L4:
        cmpw    %ax, %cx
        jne     .L7
        pushq   %rax
        .cfi_def_cfa_offset 16
        xorl    %eax, %eax
        call    foo
        xorl    %eax, %eax
        movw    $0, b(%rip)
        popq    %rdx
        .cfi_def_cfa_offset 8
        ret
.L7:
        movw    $0, b(%rip)
        xorl    %eax, %eax
        ret
---------- END OUTPUT ---------


`gcc-releases/gcc-12.2.0 -Os -S -o /dev/stdout case.c`
--------- OUTPUT ---------
main:
.LFB3:
        .cfi_startproc
        xorl    %eax, %eax
        cmpw    $0, b(%rip)
        movw    $0, b(%rip)
        setle   %al
        movb    %al, f(%rip)
        sall    $4, %eax
        movb    %al, e(%rip)
        xorl    %eax, %eax
        ret
---------- END OUTPUT ---------


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

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

end of thread, other threads:[~2024-05-21  9:13 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-10 13:10 [Bug tree-optimization/108360] New: Dead Code Elimination Regression at -Os (trunk vs. 12.2.0) yann at ywg dot ch
2023-01-10 14:48 ` [Bug tree-optimization/108360] [13 Regression] Dead Code Elimination Regression at -Os since r13-2048-g418b71c0d535bf marxin at gcc dot gnu.org
2023-01-10 17:00 ` jakub at gcc dot gnu.org
2023-01-10 17:32 ` jakub at gcc dot gnu.org
2023-01-10 17:45 ` jakub at gcc dot gnu.org
2023-01-10 19:18 ` amacleod at redhat dot com
2023-01-10 19:26 ` amacleod at redhat dot com
2023-01-10 19:28 ` amacleod at redhat dot com
2023-03-27 11:37 ` rguenth at gcc dot gnu.org
2023-04-08 14:37 ` law at gcc dot gnu.org
2023-04-26  6:57 ` [Bug tree-optimization/108360] [13/14 " rguenth at gcc dot gnu.org
2023-07-27  9:25 ` rguenth at gcc dot gnu.org
2023-08-07  8:53 ` pinskia at gcc dot gnu.org
2023-08-09  1:25 ` pinskia at gcc dot gnu.org
2024-05-21  9:13 ` [Bug tree-optimization/108360] [13/14/15 " jakub 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).