public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/103359] New: [12 Regression] Dead Code Elimination Regression at -O3 (trunk vs 11.2.0)
@ 2021-11-22 15:34 theodort at inf dot ethz.ch
  2021-11-22 22:04 ` [Bug tree-optimization/103359] " pinskia at gcc dot gnu.org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: theodort at inf dot ethz.ch @ 2021-11-22 15:34 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 103359
           Summary: [12 Regression] 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
void foo();
static char a, c;
static int d, e;
static short b(short f, short g) { return f * g; }
int main() {
  short h = 4;
  for (; d;)
    if (h)
      if(e) {
        if (!b(a & 1 | h, 3))
          c = 0;
        h = 1;
      }
  if (c)
    foo();
}

trunk cannot eliminate the call to foo but 11.2.0 can:

gcc-11.2.0 -O3 -S -o /dev/stdout case.c
main:
.LFB1:
        .cfi_startproc
        xorl    %eax, %eax
        ret
        .cfi_endproc


gcc-trunk -O3 -S -o /dev/stdout case.c
main:
.LFB1:
        .cfi_startproc
        cmpb    $0, c(%rip)
        jne     .L8
        xorl    %eax, %eax
        ret
.L8:
        pushq   %rax
        .cfi_def_cfa_offset 16
        xorl    %eax, %eax
        call    foo
        xorl    %eax, %eax
        popq    %rdx
        .cfi_def_cfa_offset 8
        ret
        .cfi_endproc

gcc-trunk -v
Using built-in specs.
Target: x86_64-pc-linux-gnu
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.0.0 20211122 (experimental) (GCC)

Started with
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=408579c9c9b8fee20e1d8114489ce2b93872767c

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

end of thread, other threads:[~2021-11-25 13:45 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-22 15:34 [Bug tree-optimization/103359] New: [12 Regression] Dead Code Elimination Regression at -O3 (trunk vs 11.2.0) theodort at inf dot ethz.ch
2021-11-22 22:04 ` [Bug tree-optimization/103359] " pinskia at gcc dot gnu.org
2021-11-22 22:23 ` pinskia at gcc dot gnu.org
2021-11-23  7:30 ` rguenth at gcc dot gnu.org
2021-11-23 10:11 ` rguenth at gcc dot gnu.org
2021-11-23 11:16 ` rguenth at gcc dot gnu.org
2021-11-23 11:36 ` rguenth at gcc dot gnu.org
2021-11-23 11:37 ` rguenth at gcc dot gnu.org
2021-11-23 13:09 ` aldyh at gcc dot gnu.org
2021-11-23 13:13 ` aldyh at gcc dot gnu.org
2021-11-23 16:03 ` amacleod at redhat dot com
2021-11-25 13:44 ` cvs-commit at gcc dot gnu.org
2021-11-25 13:45 ` 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).