public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/102650] New: Dead Code Elimination Regression at -O3 (trunk vs 11.2.0)
@ 2021-10-08 13:47 theodort at inf dot ethz.ch
  2021-10-08 16:45 ` [Bug tree-optimization/102650] " amacleod at redhat dot com
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: theodort at inf dot ethz.ch @ 2021-10-08 13:47 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 102650
           Summary: Dead Code Elimination Regression at -O3 (trunk vs
                    11.2.0)
           Product: gcc
           Version: 12.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                                                                     
      bisections
static int a = 2, b, c, d;
void foo(void);
int main() {
    short e;
    int f = -1;
    if (b)
        c = 0;
    c || (f = 2);
    for (; d < 1; d++)
        e = f + a;
    if (!e)
        foo();
    return 0;
}


11.2.0 at -O3 can eliminate the call to foo but trunk at -O3 cannot:

gcc-11 -v
Target: x86_64-pc-linux-gnu
Configured with: ../configure --disable-multilib --disable-bootstrap
--enable-languages=c,c++
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.2.0 (GCC)

gcc-11 -O3 case.c -S -o /dev/stdout
...
main:
.LFB0:
        .cfi_startproc
        movl    d(%rip), %eax
        testl   %eax, %eax
        jg      .L2
        movl    $1, d(%rip)
.L2:
        xorl    %eax, %eax
        ret

gcc-trunk -v
Target: x86_64-pc-linux-gnu
Configured with: ../configure --disable-multilib --disable-bootstrap
--enable-languages=c,c++ 
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.0.0 20211008 (experimental) (GCC)

gcc-trunk -O3 case.c -S -o /dev/stdout
...
main:
.LFB0:
        .cfi_startproc
        movl    d(%rip), %ecx
        testl   %ecx, %ecx
        jg      .L3
        movl    $1, d(%rip)
        xorl    %eax, %eax
        ret
.L3:
        pushq   %rax
        .cfi_def_cfa_offset 16
        call    foo
        xorl    %eax, %eax
        popq    %rdx
        .cfi_def_cfa_offset 8
        ret


18b88412069f51433e1b4f440d3c035bfc7b5cca
(https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=18b88412069f51433e1b4f440d3c035bfc7b5cca)
introduced this regression

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

end of thread, other threads:[~2022-11-03 19:33 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-08 13:47 [Bug tree-optimization/102650] New: Dead Code Elimination Regression at -O3 (trunk vs 11.2.0) theodort at inf dot ethz.ch
2021-10-08 16:45 ` [Bug tree-optimization/102650] " amacleod at redhat dot com
2021-10-11  8:34 ` [Bug tree-optimization/102650] [12 Regression] " rguenth at gcc dot gnu.org
2021-11-05 20:20 ` amacleod at redhat dot com
2022-01-19 14:13 ` rguenth at gcc dot gnu.org
2022-01-19 14:18 ` rguenth at gcc dot gnu.org
2022-01-19 15:15 ` amacleod at redhat dot com
2022-01-20  9:20 ` rguenth at gcc dot gnu.org
2022-01-20 14:52 ` amacleod at redhat dot com
2022-03-23  8:45 ` rguenth at gcc dot gnu.org
2022-11-03 19:33 ` [Bug tree-optimization/102650] [12/13 " amacleod at redhat 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).