public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/105835] New: Dead Code Elimination Regression at -O1 (trunk vs. 12.1.0)
@ 2022-06-03 13:31 theodort at inf dot ethz.ch
  2022-06-03 15:27 ` [Bug tree-optimization/105835] " roger at nextmovesoftware dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: theodort at inf dot ethz.ch @ 2022-06-03 13:31 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 105835
           Summary: Dead Code Elimination Regression at -O1 (trunk vs.
                    12.1.0)
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: theodort at inf dot ethz.ch
  Target Milestone: ---

cat case.c
void foo();

static int b;

static short a(short c, unsigned short d) { return c - d; }

int main() {
    int e = -(0 < b);
    if (a(1, e))
        b = 0;
    else
        foo();
}

`gcc-1982fe2692b6c3b7f969ffc4edac59f9d4359e91 (trunk) -O1` can not eliminate
`foo` but `gcc-releases/gcc-12.1.0 -O1` can.

`gcc-1982fe2692b6c3b7f969ffc4edac59f9d4359e91 (trunk) -O1 -S -o /dev/stdout
case.c`
--------- OUTPUT ---------
main:
.LFB1:
        .cfi_startproc
        cmpl    $0, b(%rip)
        movl    $65535, %eax
        movl    $0, %edx
        cmovle  %edx, %eax
        cmpw    $1, %ax
        je      .L2
        movl    $0, b(%rip)
        movl    $0, %eax
        ret
.L2:
        subq    $8, %rsp
        .cfi_def_cfa_offset 16
        movl    $0, %eax
        call    foo
        movl    $0, %eax
        addq    $8, %rsp
        .cfi_def_cfa_offset 8
        ret
---------- END OUTPUT ---------


`gcc-releases/gcc-12.1.0 -O1 -S -o /dev/stdout case.c`
--------- OUTPUT ---------
main:
.LFB1:
        .cfi_startproc
        movl    $0, b(%rip)
        movl    $0, %eax
        ret
---------- END OUTPUT ---------


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

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

end of thread, other threads:[~2022-06-20 17:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-03 13:31 [Bug tree-optimization/105835] New: Dead Code Elimination Regression at -O1 (trunk vs. 12.1.0) theodort at inf dot ethz.ch
2022-06-03 15:27 ` [Bug tree-optimization/105835] " roger at nextmovesoftware dot com
2022-06-05 19:05 ` roger at nextmovesoftware dot com
2022-06-13 12:37 ` [Bug tree-optimization/105835] [13 Regression] " rguenth at gcc dot gnu.org
2022-06-18  8:10 ` cvs-commit at gcc dot gnu.org
2022-06-20 17:10 ` roger at nextmovesoftware dot com

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).