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

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

            Bug ID: 103257
           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(void);
unsigned b, c;
static short a(short e, short f) { return e * f; }
int main() {
  if (a(1  ^ ((0, 0) ^ 1 && b) <= b, c))
    foo();
  c = 0;
}

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

gcc11  case.c -S -O3 -o /dev/stdout
main:
.LFB1:
        .cfi_startproc
        movl    b(%rip), %eax
        xorl    %edx, %edx
        testl   %eax, %eax
        setne   %dl
        cmpl    %edx, %eax
        movl    $0, %eax
        cmovb   c(%rip), %ax
        testw   %ax, %ax
        jne     .L11
        movl    $0, c(%rip)
        xorl    %eax, %eax
        ret
.L11:
        pushq   %rax
        .cfi_def_cfa_offset 16
        call    foo
        xorl    %edx, %edx
        xorl    %eax, %eax
        movl    %edx, c(%rip)
        popq    %rcx
        .cfi_def_cfa_offset 8
        ret
        .cfi_endproc


gcc-trunk -v
Target: x86_64-pc-linux-gnu
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.0.0 20211115 (experimental) (GCC)

It started with
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=0288527f47cec6698b31ccb3210816415506009e

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

end of thread, other threads:[~2021-11-19  6:43 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-15 18:21 [Bug tree-optimization/103257] New: [12 Regression] Dead Code Elimination Regression at -O3 (trunk vs 11.2.0) theodort at inf dot ethz.ch
2021-11-15 18:35 ` [Bug tree-optimization/103257] " aldyh at gcc dot gnu.org
2021-11-15 21:38 ` amacleod at redhat dot com
2021-11-16  0:40 ` pinskia at gcc dot gnu.org
2021-11-16  0:44 ` [Bug tree-optimization/103257] [9/10/11/12 " pinskia at gcc dot gnu.org
2021-11-16  0:48 ` pinskia at gcc dot gnu.org
2021-11-16  1:01 ` pinskia at gcc dot gnu.org
2021-11-16  4:52 ` pinskia at gcc dot gnu.org
2021-11-16  9:35 ` rguenth at gcc dot gnu.org
2021-11-17  8:02 ` pinskia at gcc dot gnu.org
2021-11-19  6:41 ` cvs-commit at gcc dot gnu.org
2021-11-19  6:43 ` pinskia 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).