public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/108357] New: Dead Code Elimination Regression at -O2 (trunk vs. 12.2.0)
@ 2023-01-10 12:59 yann at ywg dot ch
  2023-01-10 14:46 ` [Bug tree-optimization/108357] [13 Regression] Dead Code Elimination Regression at -O2 since r13-4607-g2dc5d6b1e7ec88 marxin at gcc dot gnu.org
                   ` (22 more replies)
  0 siblings, 23 replies; 24+ messages in thread
From: yann at ywg dot ch @ 2023-01-10 12:59 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108357
           Summary: Dead Code Elimination Regression at -O2 (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 54232
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54232&action=edit
presented code as file

cat case.c #411
static char b;
static unsigned c;
void foo();
short(a)(short d, short e) { return d * e; }
static short f(short d) {
  b = 0;
  if ((d && 0 >= c < d) ^ d)
    ;
  else
    foo();
  return d;
}
int main() {
  short g = a(5, b ^ 9854);
  f(g);
}

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

`gcc-cb93c5f8008b95743b741d6f1842f9be50c6985c (trunk) -O2 -S -o /dev/stdout
case.c`
--------- OUTPUT ---------
main:
.LFB2:
        .cfi_startproc
        movsbw  b(%rip), %ax
        movb    $0, b(%rip)
        xorw    $9854, %ax
        leal    (%rax,%rax,4), %eax
        cmpw    $1, %ax
        movswl  %ax, %edx
        setg    %al
        movzbl  %al, %eax
        cmpl    %eax, %edx
        je      .L9
        xorl    %eax, %eax
        ret
.L9:
        pushq   %rax
        .cfi_def_cfa_offset 16
        xorl    %eax, %eax
        call    foo
        xorl    %eax, %eax
        popq    %rdx
        .cfi_def_cfa_offset 8
        ret
---------- END OUTPUT ---------


`gcc-releases/gcc-12.2.0 -O2 -S -o /dev/stdout case.c`
--------- OUTPUT ---------
main:
.LFB2:
        .cfi_startproc
        movb    $0, b(%rip)
        xorl    %eax, %eax
        ret
---------- END OUTPUT ---------


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

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

end of thread, other threads:[~2024-05-22  8:32 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-10 12:59 [Bug tree-optimization/108357] New: Dead Code Elimination Regression at -O2 (trunk vs. 12.2.0) yann at ywg dot ch
2023-01-10 14:46 ` [Bug tree-optimization/108357] [13 Regression] Dead Code Elimination Regression at -O2 since r13-4607-g2dc5d6b1e7ec88 marxin at gcc dot gnu.org
2023-01-10 16:10 ` rguenth at gcc dot gnu.org
2023-03-27 12:20 ` rguenth at gcc dot gnu.org
2023-03-27 12:24 ` cvs-commit at gcc dot gnu.org
2023-03-27 12:31 ` jakub at gcc dot gnu.org
2023-03-28 17:15 ` xry111 at gcc dot gnu.org
2023-03-29  6:49 ` rguenth at gcc dot gnu.org
2023-03-29  7:36 ` xry111 at gcc dot gnu.org
2023-03-29  7:37 ` xry111 at gcc dot gnu.org
2023-03-29  9:03 ` rguenth at gcc dot gnu.org
2023-04-13 11:59 ` chenglulu at loongson dot cn
2023-04-13 12:05 ` xry111 at gcc dot gnu.org
2023-04-13 12:16 ` chenglulu at loongson dot cn
2023-04-13 13:05 ` rguenther at suse dot de
2023-04-13 13:08 ` xry111 at gcc dot gnu.org
2023-04-13 13:14 ` rguenther at suse dot de
2023-04-14 10:11 ` chenglulu at loongson dot cn
2023-04-14 10:22 ` rguenth at gcc dot gnu.org
2023-04-14 10:28 ` xry111 at gcc dot gnu.org
2023-04-14 11:22 ` chenglulu at loongson dot cn
2023-04-14 11:35 ` rguenther at suse dot de
2024-02-16 14:10 ` ro at gcc dot gnu.org
2024-05-22  8:32 ` ro 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).